Unknown line in code
2 views (last 30 days)
Show older comments
% 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; "
0 Comments
Accepted Answer
Star Strider
on 3 Jan 2018
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 Comments
More Answers (0)
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!