Take the tour ×  The code below is from the Matlab 2011a help
about fft function. I think there is a problem here : why do
they multiply t(1:50) by Fs, and then say it's time in
millisecond ? Certainly, it happens to be true in this very
particular case, but change the value of Fs to, say, 2000, and
it won't work anymore, obviously because of this factor of 2.
Right ? Quite misleading, isn't it ? What do I miss ?  Fs =
1000;                    % Sampling frequency T = 1/Fs;
% Sample time L = 1000;                     % Length of signal %
Sum of a 50 Hz sinusoid and a 120 Hz sinusoid xlabel('time
(milliseconds)')  Clearer with this :  fs = 2000;          %
Sampling frequency T = 1 / fs;         % Sample time L = 1000;
% Length of signal t2 = (0:L-1)*T;     % Time vector f = 50;
% signal frequency s2 = sin(2*pi*f*t2); figure,
plot(fs*t2(1:50),s2(1:50)); % NOT good figure,
plot(t2(1:50),s2(1:50));    % good share|improve this question
add comment  1 Answer  up vote 1 dow