I tried to write code using this formula.

enter image description here

public static Complex reverstrans(double U, double anguarFrequency, double T) { NumericalIntegration integration = new NumericalIntegration(); return (1 / (2 * Math.PI)) * integration.Calculate(w => Math.Cos(GetSpectralDensityOfAmplitude(GetSpectralDensity(U, angularFrequency, T))), 0, T) + Complex.ImaginaryOne * (1 / (2 * Math.PI)) * integration.Calculate(w => Math.Sin(GetSpectralDensityOfAmplitude(GetSpectralDensity(U, angularFrequency, T))), 0, T); } 

I want to build a graph using the reverstrans method, but I swear by the implicit transformation of Complex and double

  PointPairList list = new PointPairList(); for (double fr = xmin; fr <= xmax; fr += shag) { double angularFrequency = 2 * Math.PI * fr; list.Add(angularFrequency, reverstrans(U, anguarFrequency, T)); } 
  • And, in fact, what point do you want to add there? Should there be complex bumps with axes I and R on the chart? - qzavyer
  • one
    One more thing is strange. You add a point (fr, reverstrans(U,anguarFrequency,T)) , i.e. type (x,y) , if I understood correctly. At the same time, your y does not depend on x ( fr not an argument of reverstrans ). Why do you need to call reverstrans in a loop reverstrans ? - i-one
  • Point one is the spectral density of the amplitudes, which in turn is the modulus of a complex number (spectral density). That is, point one, the 1st coordinate is the frequency that is written in the cycle. Using the reverstrans method, I get a specific value that I need to put on the chart. But I have it complex and there was a problem how to bypass the implicit conversion and put on the chart so that I could see what is being built there. - beginner
  • one
    If you need a graph of the complex function z(x) in the axes (x,y) , then, if I'm not mistaken, you usually take either the real part ( Re(z) ) or the module ( |z| ), depending on the physical meaning. - i-one
  • one
    @beginner no, you are mistaken, there are no infinities there. However, you can limit yourself to some limits, because the high frequencies affect the waveform only slightly. - Pavel Mayorov

1 answer 1

Your problem is that you do not understand the formula you are using.

U (w) is a complex function! You cannot simply replace it with a module and substitute it into your integral.

The picture above is just a graph of the amplitude of the spectral density. To restore the waveform you need, in addition to amplitude, also a phase.

In this case, the function U (w) is even (always) - and therefore the imaginary part of u (t) goes to zero (mathematically), only the real one remains. This is what you need to draw. The imaginary part of u (t) can be used to estimate the accuracy of integration.

  • Please explain how this should happen or look like. My actions (My Algorithm) I found the spectral density of amplitudes, found the spectral density - I fit the phase - Then I substitute the phase in the formula for the inverse Fourier transform and then get a new complex function. Then I have to remove the real number from the method and add it to the plotting already? - beginner
  • @beginner go teach math - Pavel Mayorov
  • Maybe just answer my question. I'm not asking you to write me a code. And how to get and just answer. Did I write the algorithm correctly or not? Again, I wrote it from your own words and asked if it was so or not? I would learn it if there was a normal theory with examples of the inverse Fourier transform. I will learn it, as I will hand over this project and I will forget about this site, as there will be a real work. - beginner
  • one
    @beginner you wrote some nonsense about the phase. Where do you see the phase separately in the inverse Fourier transform formula? She is only there as part of U (w) - Pavel Mayorov