FourierTransform to Graph


(David Rutten) #1

I can’t figure out how to draw the waveform for a Fourier transform frequency domain. As a test case I picked the reals {0.0, 0.5, 1.0, 2.5, 4.0, 2.0} and ran them through Fourier.Forward(Complex[]) with all imaginaries being zero, getting:

Magnitude, Phase
4.082,     0.000
2.208,     2.337
0.736,    -2.337
0.000,     0.622
0.736,     2.337
2.208,    -2.337

and

Real,     Imaginary
 4.082,   0.000
-1.531,   1.591
-0.510,  -0.530
 0.000,   0.000
-0.510,   0.530
-1.531,  -1.591

Assuming the original samples are placed at unit intervals, how do I figure out the y-value of the waveform at any real parameter? I.e. the blue curve:

(via BetterExplained)

Edit:
I’ve gotten close-ish by harvesting the magnitudes and phases of complex frequency vector (but only elements 1 to N/2, so I think I’m skipping all negative frequencies). But the final graph doesn’t intersect the sample points. It’s close, and I can see it bulging in the correct location when I adjust the samples, but even allowing for a corrective vertical scale+move I cannot get the graph to exactly intersect the points:


(David Rutten) #2

Welp, never mind. It’s no good ignoring the negative frequencies like so many online sources claim. Including both the positive and negative ones gives a fittable result:


(David Rutten) #3

And implemented.