DFT using matlab function
12 ビュー (過去 30 日間)
古いコメントを表示
In case a off-nominal signal is processed using nominal frequency based fft algorithm, the peak value of the magnitude of fft is still at the frequency index or bin pertaining to the nominal value (though the amplitude is different and the side lobes also have an amplitude which is not seen when the signal has a nominal value of frequency). Why does the frequency index not change even though the frequency is no longer the nominal value. How can i visualize this in matlab using the fft function.
0 件のコメント
採用された回答
David Goodmanson
2020 年 2 月 21 日
Hi mk,
"Why does the frequency index not change even though the frequency is no longer the nominal value "
When you do an fft, the frequency array is predetermined by the properties of the time array. For an N-point fft and array spacings of delt and delf, the golden rule for ffts is
delt*delf = 1/N.
regardless of the properties of the signal. In the following code, delf = 1 so the frequency array represents exact integral frequencies. The example uses a cosine wave with f0 = 10. The total time record is 1 sec and you can see exactly 10 cycles in the time plot. In the frequency plot, fftshift is used to put f = 0 at the center of the plot. There are two peaks exactly at +-10Hz with amplitude 1/2, illustrating that
cos(2*pi*f0*t) = ( exp(i*2*pi*f0*t) + exp(-i*2*pi*f0*t) )/2.
and no frequency content anywhere else.
Now change f0 to 10.2 Hz and run it again. The frequency grid is incapable of exactly representing 10.2 Hz so it gives a reduced peak at 10 Hz, with frequency content spilling over into other frequencies.
N = 1e4;
delt = 1e-4 % total time record = 1 sec
delf = 1/(N*delt); % delf = 1;
% or you could do what is commonly done
% Fs = 1e4; sampling rate
% delt = 1/Fs;
% delf = Fs/N;
t = (0:N-1)*delt;
f = (-N/2:N/2-1)*delf; % freq grid for fftshift
f0 = 10;
y = cos(2*pi*t*f0);
figure(1)
plot(t,y); grid on
z = fftshift(fft(y)/N); % ordinarily z is complex, real in this case
figure(2)
plot(f,z,'o-'); grid on
xlim([-40,40])
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!