Hi,
I am having trouble plotting the frequency spectrum of a sine wave. For this code, i expect the main frequency component to be centered around 1/(2*pi), but they are not. Is there something I am missing in my code?
x = [0:0.1:2*pi];y = sin(x);z = fft(y);z = fftshift(z);N = length(y);f = [-N/2:N/2-1]/N;plot(f,abs(z))
Best Answer