I have solved this equation x=(4+cos(1000*pi*t+pi/3)).*(sin(500*pi*t+pi/4)) by hand and the amplitude comes to be 2 at 250 Hz. when i plot this in matlab from range -500 to 500, it matches my hand solved answer. But when i change the range from -1000 to 1000, it shows amplitude 1.8. Why it is so
Code for -500 to 500
Fs = 1000;t = 0:1/Fs:1-(1/Fs);x=(4+cos(1000*pi*t+pi/3)).*(sin(500*pi*t+pi/4));xdft = (1/length(x))*fft(x);freq = -500:(Fs/length(x)):500-(Fs/length(x));plot(freq,abs(fftshift(xdft)))xlabel('Freq(Hz)-------->')ylabel('Amplitude')
Now code from -1000 to 1000
Fs = 2000;t = 0:1/Fs:1-(1/Fs);x=(4+cos(1000*pi*t+pi/3)).*(sin(500*pi*t+pi/4));xdft = (1/length(x))*fft(x);freq = -1000:(Fs/length(x)):1000-(Fs/length(x));plot(freq,abs(fftshift(xdft)))xlabel('Freq(Hz)-------->')ylabel('Amplitude')
Why it is so
Best Answer