I am trying to understand the fft function, for that I have a really simple code to generate a sine wave of 500Hz.
%Time specifications:
Fs = 1000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.6; % seconds
t = (0:dt:StopTime-dt)'; % seconds
% Sine wave:
Fc = 500; % hertz
x = sin(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (in seconds)');
title('Signal versus Time');
zoom xon;
Now, the output of that give me a sinusoidal wave which amplitude increases with time.
Why is that? when I didnt add any factor for amplitude. I know that has something to do with the Fs value. what is it exactly?
Thank you
0.001
as atime step. You are building the sine of(2*pi*500*t)
. This results in :(2*pi*500/1000=pi)
,(2*pi*500*2/1000)=2pi)
. This is just not useful. Change your frequency (Fc) to sth. smaller e.g. 50 or use smaller timesteps, thus changing Fs to 5000 or just define dt as 1/5*Fs. – The Minion