PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 87


MATLAB Solution
% Script file: modulation

figure(1)
subplot(2,2,1); % analog signals
fplot(‘3*cos(5*t)’,[0 3 -6 6]);
title(‘Information signal: 3*cos(5*t)’);
ylabel(‘Amplitude’);xlabel(‘time’);
subplot(2,2,2)
fplot(‘cos(50*t)’,[0 0.5 -1.5 1.5]);
title(‘Carrier signal: cos(50*t)’);
ylabel(‘Amplitude’);xlabel(‘time’);
subplot(2,2,3)
fplot(‘3*cos(50*t)*cos(5*t)’,[0 3 -6 6]);
title(‘AM (Amplitude Modulated) signal’);
ylabel(‘Amplitude’);
xlabel(‘time’);
subplot(2,2,4)
fplot(‘3*cos((50*t)+3*cos(5*t))’,[0 2 -6 6]);
title(‘Angle Modulated signal’);
xlabel(‘time’);
ylabel(‘Amplitude’);

figure(2)
a=3*ones(1,50);
b=ones(1,50);
clock = [a b a b]; % discrete/binary signals
t = linspace(0,4,200);
carrier = cos(50*t);
subplot(2,2,1)
plot(t,clock);title(‘Binary information signal’);
axis([0 4 0 4]);ylabel(‘Amplitude’);
xlabel(‘time’);
subplot(2,2,2)
ASK= carrier.*clock;plot(t,ASK);
title(‘ASK signal’)
axis([0 4 -4 4]);ylabel(‘Amplitude’);
xlabel(‘time’);
subplot(2,2,3)
FSK=cos(20*t.*clock);
plot(t,FSK);xlabel(‘time’)
axis([0 4 -1.3 1.3]);ylabel(‘Amplitude’)
title(‘FSK signal’)
subplot(2,2,4)
PSK=cos(50*t+clock);
plot(t,PSK);
title(‘PSK signal’)
xlabel(‘time’); ylabel(‘Amplitude’);
axis([0 1.5 -1.3 1.3]);

Back in the command window the script fi le modulation is executed and the results are
shown in Figures 1.73 and 1.74.
Free download pdf