How many periods it is needed for fft to give us a proper estimate over frequency?
36 views (last 30 days)
Show older comments
Dear all,
I have a basic question. Imagine a simple sinusoidal defined as below:
Fs = 150;
t = 0:1/Fs:0.2;
f = 5;
x = sin(2*pi*t*f);
nfft = 1024;
X = fft(x,nfft);
X = X(1:nfft/2);
MX = abs(X);
f = (0:nfft/2-1)*Fs/nfft;
plot(f,MX)
The period of signal(lambda) is 0.2 (f=5). Now, if I change this expression(t = 0:1/Fs:0.2;) any time before plotting, from a half sine (t = 0:1/Fs:0.1;) to 5 repeated periods (t = 0:1/Fs:1;), only after when two full periods are at least used for calculating fft, fft gives us a good estimate(something around 5) of the signal frequency. Why?
0 Comments
Answers (2)
Wayne King
on 5 Nov 2013
It's not that simple. You can get a good estimate with just one period depending on the frequency spacing in the DFT.
Fs = 500;
t = 0:1/Fs:0.2-1/Fs;
x = cos(2*pi*5*t);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
df = Fs/length(x);
freqvec = 0:df:250;
stem(freqvec,abs(xdft),'markerfacecolor',[0 0 1])
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!