MATLAB: I want to write matlab code that calculates fourier transform of following sequence and also plots its magnitude x(k)

fftMATLAB

x(n) = 3cos(4*pi*n/N) + sin(6*pi*n/N) where 0 <= n=< N-1 0 <= k =< N-1

Best Answer

N=100;%%you can change it
n=0:N-1;
x=3*cos(4*pi*n/N)+sin(6*pi*n/N);
FFT=fft(x);
plot(abs(FFT))
Also please check
help fft