MATLAB: Unknown line in code

code line

% 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; "

Best Answer

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).