DSPRelated.com
Forums

Plotting of FFT graph in Excel

Started by sulphox December 7, 2005
Hi all, I'm sorry to bother you guys again.

Is the formula, f(i) = i*(sampling_rate / FFTsize)
applicable to all the different type of input signal?

or it only applicable when rect(t) is the input signal?

I tried to apply the formula on another mathematical function.i.e.
sinc(x)
after that, i plotted f(i) vs ABS of Y(f) using the same method.

The shape graph is like an inverted rect(t).
Is this the correct graph's that i should get?
i have a feeling i got the wrong graph.

Please advise me.
Thank you.


Sulphox

sulphox wrote:
> Hi all, I'm sorry to bother you guys again. > > Is the formula, f(i) = i*(sampling_rate / FFTsize) > applicable to all the different type of input signal? > > or it only applicable when rect(t) is the input signal?
That formula is applicable to an FFT (or DFT) of any input signal. It's just for labeling the x-axis (frequency axis).
> I tried to apply the formula on another mathematical function.i.e. > sinc(x) > after that, i plotted f(i) vs ABS of Y(f) using the same method. > > The shape graph is like an inverted rect(t). > Is this the correct graph's that i should get? > i have a feeling i got the wrong graph.
You got the right graph. The FFT of a sinc() function is a rect() function. It looks like an inverted rect() when you plot the FFT from Y[i]...Y[FFTsize-1]. But the items above FFTsize/2 are the negative frequencies, so try rearranging to plot it like this: Y[FFTsize/2+1] ... Y[FFTsize-1] Y[0] ... Y[FFTsize/2] For example, if your FFTsize was 8, it would be re-arranged like this: Y[5] Y[6] Y[7] Y[0]: DC Y[1] Y[2] Y[3] Y[4]: Nyquist Note that it now looks like a normal (non-inverted) rect() function. For a real input (one with 0 for the imaginary part, such as a sinc() function), you only need to look at the positive frequencies. Try plotting it like this: Y[0]: DC Y[...] Y[FFTsize/2]: Nyquist Now you can see that it's a lowpass filter. This is likely the purpose of the exercise - to demonstrate that a sinc() function in the time domain is an ideal lowpass filter in the frequency domain. However, it takes an infinitely long sinc() function to make an ideal lowpass filter. Read up on the windowed sinc FIR filter to learn about a method used to overcome this limitation in practical applications. Bob
I see.

Thanks for your help Bob.

By the way, Merry Christmas to all :D 

Sulphox