1,161 views (last 30 days)

Show older comments

I have this code, I am suppose sin of amplitude 10 with frequency 200hz and sampling frequency 20000 hz and do FFT on this signal,

why the Amplitude after FFT is 1000?? where the amplitude must be stay 10

Fs = 20000;

t = 0:1/Fs:0.01;

fc1=200;

x = 10*sin(pi*fc1*t)

x=x';

xFFT = abs(fft(x));

xDFT_psd = abs(fft(x).^2);

Matt
on 15 Nov 2014

Edited: Matt
on 17 Nov 2014

Mary,

In general, to return a FFT amplitude equal to the amplitude signal which you input to the FFT, you need to normalize FFTs by the number of sample points you're inputting to the FFT.

Fs = 20000;

t = 0:1/Fs:0.01;

fc1=200;

x = 10*sin(pi*fc1*t)

x=x';

xFFT = abs(fft(x))/length(x);

xDFT_psd = abs(fft(x).^2);

Note that doing this will divide the power between the positive and negative sides, so if you are only going to look at one side of the FFT, you can multiply the xFFT by 2, and you'll get the magnitude of 10 that you're expecting.

The fft documentation has a pretty good example that illustrates this and some other fft best practices.

*Edited for clarity, - see Matt J's comment for the original statement.

Guanjiang Chen
on 11 May 2021

Matt J
on 16 Nov 2014

Edited: Matt J
on 16 Nov 2014

Brince Babu
on 13 Nov 2020

Frantz Bouchereau
on 29 Jul 2021

There are various ways in which you can compute and plot true power spectrum or power spectral density in MATLAB (when I say 'true power spectrum' I mean that the output values correspond to actual power values).

1) If you want to compute the power spectrum without having to specify many parameters and want the function to choose the best parameters for you, you can use pspectrum. Calling the function without outputs will give you a plot with the computed power spectrum.

2) If you want to compute power spectrum or power spectral density and want full control over the window size, window overlap, window type, and number of FFT points, you can use the Welch periodogram pwelch function. Calling the function without outputs will give you a plot with the computed power spectrum.

3) If you want to just visualize the power spectrum, you can use the Signal Analyzer app. The app let's you visualize your signals simultaneously in the time, frequency, and time-frequency domains. You can zoom into signal regions of interest and analyze the spectra at those zoomed regions.

4) If you have split your signals into multiple signal frames you can use the Spectrum Analyzer scope.

Finally, here is a popular MATLAB doc page that explains the relationship between FFT and true power spectra: Power Spectral Density Estimates Using FFT.

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!