% Multiple Sinusoids:
%
% @ Kefu Xue, Ph.D., June 2006
%
f0=20; % fundamental frequency from Maximum Common Factor: 40pi
T0=1/f0; % shortest period of the signal
T=T0/40; % sampling 40 samples over a period of the signal
N=120; % plot 3 periods
t=[0:N-1]*T; % time sampling vector
s1=2*cos(200*pi*t-1);
s2=sin(120*pi*t+pi/3);
s3=-0.5*cos(80*pi*t+2);
x=s1+s2+s3;
cos200pi=cos(200*pi*t);
sin120pi=sin(120*pi*t);
cos80pi=cos(80*pi*t);
% compare the signals 
figure;subplot(4,1,1);plot(t,cos200pi,'b',t,s1,'r');axis tight; 
title('Compare the first sinusoid with a plan cosine function');
subplot(4,1,2);plot(t,sin120pi,'b',t,s2,'r');axis tight; 
title('Compare the second sinusoid with a plan sine function');
subplot(4,1,3);plot(t,cos80pi,'b',t,s3,'r');axis tight; 
title('Compare the third sinusoid with a plan cosine function');
subplot(4,1,4);plot(t,x,'b');axis tight; 
title('The complete signal.');
xlabel('time in second');

