Anda di halaman 1dari 12

Name : MAHESWARAN VIRASAGARAM

Matric No. : BE090046


Section : 03
Lecturer : DR DAVID IAN FORSYTH
Due Date : 08/04/2011 (5.00PM)

Assignment 1: MATLAB

a) Design a programme to produce a wave with modulation index>1, =1 and <1.

[ m>1 ] ; m=0.5

Programme Script:

%Amplitude modulation ----Single Tone Modulation


%Carrier Amplitude
Ac=1;
%Carrier frequency
Fc=0.4;
%baseband frequency
Fm=0.05;
%sampling
Fs=10;
%%undermodulation
mu=0.5;
t=0:1/Fs:200;
mt=cos(2*pi*Fm*t);
st=Ac*(1+mu*mt).*cos(2*pi*Fc*t);
subplot(2,1,1);
plot(t,st,t,Ac*(mu*mt+ones(1,length(mt))),'r');
title('\mu=0.5 undermodulation£ºAc(1+\mucos(2\pi0.05t))cos(2\pi0.4t)');
xlabel('time (s)');ylabel('amplitude');
st_fft=fft(st);
st_fft=fftshift(st_fft);
st_fft_fre=Fs/2*linspace(-1,1,length(st_fft));
% st_fft=abs(st_fft(1:length(st_fft)/2+1));
% st_fft_fre=[0:length(st_fft)-1]*Fs/length(st_fft)/2;
subplot(2,1,2);
plot(st_fft_fre,abs(st_fft));
title('spectrum£ºside frequency amplitude=carrier frequency amplitude*\mu/2');
xlabel('Frequency (Hz)');axis([-1 1 0 1000*Ac+100]);
[ Command Window ]
[ Waveform and Frequency Spectrum for m=1 (m<1) ]
[ m=1 ]

Programme Script:

%total modulation
Fs=10;
Fm=2;
figure;
mu=1;
t=0:1/Fs:50;
mt=cos(2*pi*Fm*t);
st=Ac*(1+mu*mt).*cos(2*pi*Fc*t);
subplot(2,1,1);
plot(t,st,t,Ac*(mu*mt+ones(1,length(mt))),'r');
title('\mu=1 total modulation£ºAc(1+\mucos(2\pi0.05t))cos(2\pi0.4t)');
xlabel('time (s)');ylabel('amplitude');
st_fft=fft(st);
st_fft=fftshift(st_fft);
st_fft_fre=Fs/2*linspace(-1,1,length(st_fft));
subplot(2,1,2);
plot(st_fft_fre,abs(st_fft));
title('spectrum£ºside frequency amplitude=carrier frequency amplitude*\mu/2');
xlabel('Frequency (Hz)');axis([-1 1 0 1000*Ac+100]);
[ Command Window ]
[ Waveform and Frequency Spectrum for m=1 ]
[ m>1 ] ; m=2.0

Programme Script:

%%overmodulation
figure;
mu=2;
t=0:1/Fs:50;
mt=cos(2*pi*Fm*t);
st=Ac*(1+mu*mt).*cos(2*pi*Fc*t);
subplot(2,1,1);
plot(t,st,t,Ac*(mu*mt+ones(1,length(mt))),'r');
title('\mu=2 overmodulation£ºAc(1+\mucos(2\pi0.05t))cos(2\pi0.4t)');
xlabel('time (s)');ylabel('amplitude');
st_fft=fft(st);
st_fft=fftshift(st_fft);
st_fft_fre=Fs/2*linspace(-1,1,length(st_fft));
subplot(2,1,2);
plot(st_fft_fre,abs(st_fft));
title('spectrum£ºside frequency amplitude=carrier frequency amplitude*\mu/2');
xlabel('Frequency (Hz)');axis([-1 1 0 1000*Ac+100]);
[ Command Window ]
[ Waveform and Frequency Spectrum for m=2 (m>1) ]
b) Show a wave with a variety of harmonics.

Programme Script:

t = 0:.1:10;
y = sin(t);
plot(t,y);

[ Command Window ]

[ Waveform ]
If a third harmonic is added to the system;

Programme Script:

y = sin(t) + sin(3*t)/3;
plot(t,y);

[ Command Window ]

[ Waveform ]
Then, first, third, fifth, seventh, and ninth harmonics were added to system;

Programme Script:

y = sin(t) + sin(3*t)/3 + sin(5*t)/5 + sin(7*t)/7 + sin(9*t)/9;


plot(t,y);

[ Command Window ]

[ Waveform ]

Anda mungkin juga menyukai