Why is there a factor of 2 in the example provided in the help documentation for the FFT command?
5 views (last 30 days)
Show older comments
In the example provided in the help documentation for the FFT command, there seems to be an extra factor of 2 that the spectrum is multiplied by before being plotted.
The snippet of code is provided below:
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2)))
title('Single-Sided Amplitude Spectrum of y(t)')
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
In this example, the single-sided spectrum is considered to be only the positive-frequency half of the frequency spectrum.
To compensate analytically for the notion that no negative frequencies exist, the symmetrical negative frequency components are truncated using Y(1:NFFT/2) and the positive frequency components are multiplied by two instead.
0 Comments
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!