Page 1 of 1

Question FFT spectrum rebuild and result interpretation

PostPosted: Mon Jan 20, 2020 1:20 pm
by chackl
Hello!

I did a research again on some FFT things i did in the past and grabbed some older examples. But i always had an little error at iFFT that gave me a wron signal back (Not that wrong that you just notice it fast)

So i just to ask if someone can confirm this:

If you do a FFT with let's say 512 points you will get a magnitude spectrum that is "symetric" - But it is not that symetric as i thought:

Magnitude:
Point 0 is kind of Frequency 0 and defines the amp off-set from the whole wave
Point 1 to 255 is the spectrum
Point 256 is the amp of Frequency 1 - But it has added the symetric part too - so the real value is its half.
Point 257 to 511 is the amp-spectrum reversed without Point 256 and 0

So the point count of the real magnitude is 257 (N/2+1)

Phase:
Point 0 is the phase of the sin-offset
Point 1 to 255 phase for each frequenzy
Point 256 is the phase for frequenzy 1 - But it seems to have no symetric here
Point 257 to 511 is the phase of ech frequenzy inverted and reversed.

Am i missing something again?
Thx, C.Hackl

Re: Question FFT spectrum rebuild and result interpretation

PostPosted: Tue Jan 21, 2020 9:01 pm
by martinvicanek
Think of the array as circular, with both ends joined seamlessly.
One way to visualize the symmetry of the Fourier transform is this:
Code: Select all
    ----------------------------------->
    X[1],   X[2],   ...   X[254], X[255],
X[0],                                   X[256],
    X[511], X[510], ...   X[258], X[257],
    <-----------------------------------

The first element, X[0], denotes the DC offset. Then the upper row X[1] through X[255] represent bins with increasing frequrncy up to X[256], wich is the Nyquist frequency. Then the array folds back going from X[257] to the last element X{511]. The next element would be X[0], which closes the loop.

Arranged in this way, for a Fourier transform of a real input array the magnitudes of two elements on top of each other (for instance X[2] and X[510]) are equal, whereas their phases are equal in magnitude but with opposite signs.

If you prefer to look at real and imaginary parts rather than magnitude and phase, then we can say: two elements on top of each other have the same real part and have opposite imaginary parts.

Re: Question FFT spectrum rebuild and result interpretation

PostPosted: Wed Jan 22, 2020 12:05 am
by chackl
Thank you!

Got it now and marked many example-schematics as "wrong" (as it just was the nyquist wrong)

Re: Question FFT spectrum rebuild and result interpretation

PostPosted: Tue Jan 28, 2020 4:38 pm
by wlangfor@uoguelph.ca
FFT is exciting, I've wanted to delve into it but I've been busy trying to get filters and graphics elements working like commercial apps.

Nice idea with fft.