DSPRelated.com
Forums

spectrum of harmonic sinusiods by using FFT

Started by s210...@hotmail.com June 24, 2009
Hi all

I have three cos' (x1, x2, and X3)and I want to plot the spectrum of them by using the following matlab code. after I plotted the spectrum I got three sincs but with small diffrent peak value!

my quetion: why the three sincs do not have the same peak value, with shift only?

Thanks in advanced
------------
matlab used code:
N$;
n=0:N-1;
%x1=cos(2*pi*1000*t) fs$000hz
%x2=cos(2*pi*2000*t) fs$000hz
%x3=cos(2*pi*3000*t) fs$000hz
x1=cos(pi*n/12);
x2=cos(pi*n/6);
x3=cos(pi*n/4);

y(:,1)t(x1,3000);
y(:,2)t(x2,3000);
y(:,3)t(x3,3000);

figure(1)
subplot(311);plot(x1,'.-')
subplot(312);plot(x2,'.-')
subplot(313);plot(x3,'.-')
figure(2)
subplot(311);plot(real(y));grid
subplot(312);plot(imag(y));grid
subplot(313);plot(abs(y));grid
----------------