I used MATLAB to produce a simple sine wave over time:
frequency=7 sampling_frequency=1000; total_time=1-1/sampling_frequency; step=1/1000; theta=0; time=0:step:total_time; y=Amplitude*sin(2*pi*frequency*time+theta)
I then used the following code to fast fourier transform:
Y=fft(y); ploty=Y/length(y); stem(abs(ploty))
I was expecting to see one spike at 7 instead I am getting 2 and not even at 7. One is at 8 and the other at 994. I am totally confused as to why.