Why isn't the output of an N point FFT discrete ?
2 ビュー (過去 30 日間)
古いコメントを表示
Chinmay Samudra
2017 年 8 月 22 日
編集済み: David Goodmanson
2017 年 8 月 23 日
I have written a code that samples and quantizes a cosine function and then finds it's FFT. I have got two questions: 1. Why is the output of the FFT shown as a continuous plot ? 2. The FFT doesn't give the correct frequency of my cosine function. Why ?
N=8
m=16
f=m*fs/(2^N); %Frequency of sinusoid
nCyl=16; %generate sixteen cycles of sinusoid
t=0:1/fs:nCyl*1/f; %time index
x=cos(2*pi*f*t);
ff=fft(x,256);
l=20*log10(ff)
plot((20*log10(abs(ff/256))))
Theoretically this code should produce a graph showing a big peak at 16 but that peak is coming at 17 . Why ?
0 件のコメント
採用された回答
David Goodmanson
2017 年 8 月 23 日
編集済み: David Goodmanson
2017 年 8 月 23 日
Hi Chinmay,
If by 'isn't discrete' you are referring to the values in between the peaks, they are basically at the numerical limit for double precision. You might prefer plot(20*log10(abs(ff/256)),'o'), or stem(20*log10(abs(ff/256))+300) for the result relative to -300 dB. As for the peak location, an fft output array starts with zero frequency in ff(1), so f=16 is in ff(17).
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!