7.pam Matlab Program

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

PULSE AMPLITUDE MODULATION AND

DEMODULTION(PAM)
AIM: To verify the waveforms of pulse amplitude modulation and demodulation.

APPARATUS:

1. Personal Computer.
2. MATLAB 2010.

PROGRAM:

clc;
clear all;
close all;
fc=100;
fm=fc/10;
fs=100*fc;
t=0:1/fs:4/fm;
mt=cos(2*pi*fm*t);
ct=0.5*square(2*pi*fc*t)+0.5;
st=mt.*ct;
tt=[];
for i=1:length(st);
if st(i)==0;
tt=[tt,st(i)];
else
tt=[tt,st(i)+2];
end
end
figure(1)
subplot(4,1,1);
plot(t,mt);
title('MESSAGE SIGNAL');
xlabel('time period');
ylabel('amplitude');
subplot(4,1,2);
plot(t,ct);
title('CARRIER SIGNAL');
xlabel('time period');
ylabel('amplitude');
PULSE AMPLITUDE MODULATION AND
DEMODULTION(PAM)
subplot(4,1,3);
plot(t,st);
title('MODULATED SIGNAL OF DOUBLE SIDE BAND');
xlabel('time period');
ylabel('amplitude');
subplot(4,1,4);
plot(t,tt);
title('PAM OF SINGLE SIDE BAND');
xlabel('time period');
ylabel('ampiltude');
dt=st.*ct;
dt_frequency=fftshift(abs(fft(dt)));
filter=fir1(200,fm/fs,'low');
original_t_signal=conv(filter,dt);
original_f_signal=fftshift(abs(fft(original_t_signal)));
t1=0:1/(length(original_t_signal)-1):1;
f=-fs/2:fs/(length(original_f_signal)-1):fs/2;

RESULT:

You might also like