Vous êtes sur la page 1sur 4

EXPERIMENT 4:

DIGITALLY MODULATED SIGNALS USING MATLAB:


PAM (ASK), PSK, AND QAM

1) OBJECTIVE
To study digitally modulated signals PAM (ASK), PSK, and QAM using MATLAB
and construct their constellation diagrams, baseband and passband forms.

2) PRELAB
Consider the following three sets of signals (Set I, Set II, and Set III).

Find the geometric representation of the signals in each set.


What is the average transmitted energy for each signal set?

3) LAB WORK
1. Copy the experiment file.
2. Examine and then run the file, observe the OPs.
3. Initially label the OP of randint as x1 (t ), x2 (t ),..., xM (t ) and the corresponding OP
of dmodce as s1 (t ), s2 (t ),..., sM (t ) . Set M = 8 and 16 consecutively, find and draw
the corresponding waveforms and write for vectors of PAM (ASK), PSK and QAM.
Indicate these on the waveforms and constellation diagrams. Label your drawings
clearly. During your runs do not change the original n, Fs, and fc settings.
4. Include your general comments.

MATLAB CODE
% This program shows the illustration of PAM (ASK), PSK, and QAM signals.
% Both bandpass and passband signals are shown. Keep the n, Fs , and fc settings.
clear; clc; close all
n = 4; % Number of symbol intervals
M = 16; % Use M-ary modulation
Fd = 1; % Sampling rate of the message signal
Fs = 100; % Sampling rate of the modulated signal
fc = 18; % Carrier frequency
x = randint(n,1,M); % Random multilevel message signal (from zero to M-1)
xt = reshape(repmat(x,1,Fs)',1,n*Fs); t = 1:1:n*Fs; % Arrange time axis

% PAM (ASK) Signals


% A) Baseband ASK
sask = real(dmodce(x,Fd,Fs,'ask',M)); modmap('ask',M); set(gcf,'Color',[1 1 1])
pause
subplot(2,1,1); plot(t,xt); title('Input signal x(t) as M-ary levels')
axis ([min(t) max(t) -0.1 max(x)*1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
subplot(2,1,2); plot(t,sask); title('ASK baseband signal - s_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
pause; clf reset

% B) Bandpass PAM (ASK)


uask = dmod(x,fc,Fd,Fs,'ask',M);
subplot(2,1,1); plot(t,sask); set(gcf,'Color',[1 1 1])
title('ASK baseband signal - s_m(t)')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
subplot(2,1,2); plot(t,uask); title('ASK bandpass signal - u_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
pause

% PSK Signals
% A) Baseband PSK
spsk = dmodce(x,Fd,Fs,'psk',M); figure; modmap('psk',M);set(gcf,'Color',[1 1 1])
pause
subplot(2,1,1); plot(t,xt); title('Input signal x(t) as M-ary levels')
axis ([min(t) max(t) -0.1 max(x)*1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');

s1psk = reshape(spsk,Fs/2,2*n);smtpsk = [];


for i = 1:2:2*n-1
s3 = [real(s1psk(:,i));imag(s1psk(:,i+1))];
smtpsk = [smtpsk;s3];
end
subplot(2,1,2); plot(t,smtpsk); title('PSK baseband signal - s_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
pause;clf reset

% B) Bandpass PSK
upsk = dmod(x,fc,Fd,Fs,'psk',M);
subplot(2,1,1); plot(t,smtpsk); set(gcf,'Color',[1 1 1])
title('PSK baseband signal - s_m(t)')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
subplot(2,1,2); plot(t,upsk); title('PSK bandpass signal - u_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
pause

% QAM Signals
% A) Baseband QAM
sqam = dmodce(x,Fd,Fs,'qask',M); figure; modmap('qask',M); set(gcf,'Color',[1 1 1])
pause
subplot(2,1,1); plot(t,xt); title('Input signal x(t) as M-ary levels')
axis ([min(t) max(t) -0.1 max(x)*1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
s1qam = reshape(sqam,Fs/2,2*n); smtqam = [];
for i = 1:2:2*n-1
s3 = [real(s1qam(:,i));imag(s1qam(:,i+1))];
smtqam = [smtqam;s3];
end
subplot(2,1,2); plot(t,smtqam); title('QAM baseband signal - s_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -M*0.9/2 M*0.9/2])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
pause; clf reset

% B) Bandpass QAM
uqam = dmod(x,fc,Fd,Fs,'qask',M);
subplot(2,1,1); plot(t,smtqam); set(gcf,'Color',[1 1 1])
title('QAM baseband signal - s_m(t)')

axis ([min(t) max(t) -M*0.9/2 M*0.9/2])


set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');
subplot(2,1,2); plot(t,uqam); title('QAM bandpass signal - u_m(t)'); xlabel('Time Axis')
axis ([min(t) max(t) -1.1 1.1])
set(gca,'XTick',[50 100 150 200 250 300 350 400])
set(gca,'XTickLabel',{'T/2';'T';'3T/2';'2T';'5T/2';'3T';'10T/2';'4T'},'FontWeight','bold');

Vous aimerez peut-être aussi