As for cos(2*pi*t), the peaks locates at -1 and 1 Hz with a value of 0.5. It's correct.
t = 0:0.1:10; x = cos(2*pi*t); y = fft(x)/length(x); real(fftshift(y))
As for sin(2*pi*t), the peak locations are correct but the polarity is reversed from the theoretical predition.
t = 0:0.1:10; x = sin(2*pi*t); y = fft(x)/length(x); imag(fftshift(y))
We know that the fourier transform of exp(-pi*t^2) is exp(-pi*f^2). Thus, the peak amplitude is expected to be 1.
t = -10:0.2:10; t = ifftshift(t); x = exp(-pi*t.^2); y = fft(x)/length(x); real(fftshift(y))
but the peak of the amplitude spectrum by fft is 0.05, not 1 as predicted by the analytic solution.
Best Answer