Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Ex.

pt No: SIMULATION OF SIGNAL CONSTELLATION FOR QAM


Date: AND QPSK USING MATLAB

AIM:
To simulate signal constellation for QAM (Quadrature amplitude modulation) and
QPSK( Quadrature phase shift keying) using MATLAB and obtain output.

APPARATUS REQUIRED:
MATLAB Software

THEORY:
Constellation diagram:
 A constellation diagram is a representation of a signal modulated by a digital modulation
scheme such as quadrature amplitude modulation or phase-shift keying it displays the
signal as a two-dimensional xy-plane scatter diagram in the complex plane at symbol
sampling instants.

QAM:
 Quadrature Amplitude Modulation, QAM is a form of modulation that is a combination
of phase modulation and amplitude modulation.
 The QAM scheme represents bits as points in a quadrant grid known as a constellation
map. It is a graph of the phase and amplitude modulation points in a given modulation
scheme.

QPSK:
 Quadrature Phase Shift Keying (QPSK) is a form of Phase Shift Keying in which two bits
are modulated at once, selecting one of four possible carrier phase shifts (0, 90, 180, or
270 degrees). QPSK allows the signal to carry twice as much information as ordinary
PSK using the same bandwidth.
 QPSK uses four points on the constellation diagram, equi-spaced around a circle. With
four phases, QPSK can encode two bits per symbol.

Code for QAM:


N=1024;
M=16;
data=randi([0 M-1],1,N);
s=qammod(data,M);
SNR=20;
r=awgn(s,SNR,'measured');
bit_rate=10.^3;
OUTPUT:
f=bit_rate;
Tb=1/bit_rate;
t=0:(Tb/1000):Tb;
TxSig=[];
for i=1:length(data)
Tx=real(s(i))*cos(2*pi*f*t)-imag(s(i))*sin(2*pi*f*t);
TxSig= [TxSig,Tx]; %#ok<AGROW>
end
RxSig=awgn(TxSig,SNR,'measured');
figure(1)
subplot(3,1,1);
stairs(data);grid minor;ylim([-0.5,M-0.5]);xlim([0,N]);
title(' Message Signal');
subplot(3,1,2);
plot(TxSig);grid minor;title('16-QAM modulated signal');
xlim([0,N*10^3+N]);
subplot(3,1,3);
plot(TxSig);grid minor;title('16-QAM modulated signal with AWGN');
xlim([0,N*10^3+N]);
scatterplot(r);
grid minor;
title('Constellation Diagram of 16-QAM');

Code for QPSK:


N=1024;
M=4;
data=randi([0 M-1],1,N);
s=pskmod(data,M,pi/4);
SNR=20;
r=awgn(s,SNR,'measured');
bit_rate=10.^3;
f=bit_rate;
Tb=1/bit_rate;
t=0:(Tb/1000):Tb;
TxSig=[];
for i=1:length(data)
Tx=real(s(i))*cos(2*pi*f*t)-imag(s(i))*sin(2*pi*f*t);
TxSig= [TxSig,Tx]; %#ok<AGROW>
end
Output:
RxSig=awgn(TxSig,SNR,'measured');
figure(1)
subplot(3,1,1);
stairs(data);grid minor;ylim([-0.5,M-0.5]);xlim([0,N]);
title(' Message Signal');
subplot(3,1,2);
plot(TxSig);grid minor;title('QPSK modulated signal');
xlim([0,N*10^3+N]);
subplot(3,1,3);
plot(TxSig);grid minor;title('QPSK modulated signal with AWGN');
xlim([0,N*10^3+N]);
scatterplot(r);
grid minor;
title('Constellation Diagram of QPSK');

AIM &

PROCEDURE CODING VIVA

RESULT:
Thus the simulation of signal constellation for QAM and QPSK is done using
MATLAB and the output is obtained successfully.

You might also like