Unknown line in code

1 回表示 (過去 30 日間)
Bruce Pollom
Bruce Pollom 2018 年 1 月 3 日
回答済み: Star Strider 2018 年 1 月 3 日
% P0=90;
% Ps=10000;
% Ts=1/Ps;
% t=0:Ts:0.4;
% w0=2*pi*F0;
% A=2;
% x=A*sin(w0*t)
%
% Nfft=length(x)*32;
% x=fft(x,Nfft);
% x=fftshift(x);
% F=-Fs/2:Fs/Nfft:Fs/2-Fs/Nfft;
%
In the code above, what is the point of this line ? : " % F=-Fs/2:Fs/Nfft:Fs/2-Fs/Nfft; "

採用された回答

Star Strider
Star Strider 2018 年 1 月 3 日
This line:
F=-Fs/2:Fs/Nfft:Fs/2-Fs/Nfft;
defines the frequency vector for a two-sided fft, where 0 Hz is in the centre of the plot. Here, ‘Fs’ is the sampling frequency, undefined in the code you posted (but is probably 1/Ts).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by