You are on page 1of 6

Assignment 4: Simulate a Basic

Digital Communications Link

Table of Contents
General Information ............................................................................................................................. 1
Clean Up ........................................................................................................................................... 1
Parameters Definition (Transmitter, Tx & Rx Filters, and Channel Effect) ..................................................... 1
Paramater Definition (Receiver Part) ...................................................................................................... 2
Plotting the Eye Diagram ..................................................................................................................... 2

General Information
Author: Haider Hasan Hamood

Date Created: 18/3/2024

Context: ECE308, Computer Aided Communication Systems Design Lab

Objective: We want to model a communication link using 16-QAM Modulation and analyze it using "eye diagram"
and see the effect of noise on the diagram

Clean Up
clear;
clc;
close all;

Parameters Definition (Transmitter, Tx & Rx Fil-


ters, and Channel Effect)
numOfBits = 1500; % The number of bits we want to transmit in the sequence
sourceBits = randi([0, 1], numOfBits, 1); % Random binary sequence

qamModOrder = 16; % The order of QAM modulation scheme


samplesPerSymbol = 16;
modOut_noNoise = qammod(sourceBits, qamModOrder, 'InputType','bit', ...
'UnitAveragePower', true); % QAM Modulation with average power scaled to 1

txFilter = comm.RaisedCosineTransmitFilter("OutputSamplesPerSymbol",
samplesPerSymbol);
rxFilter = comm.RaisedCosineReceiveFilter('InputSamplesPerSymbol',
samplesPerSymbol, ...

1
Assignment 4: Simulate a Basic
Digital Communications Link

'DecimationFactor', samplesPerSymbol);

modOut_Filtered = txFilter(modOut_noNoise); %Filtering the modulated data


before transmitting

SNR = 20; % [dB] Signal-to-Noise ratio arbitrarily chosen to be 7dB

modOut_Noise = awgn(modOut_Filtered, SNR, "measured"); % Adding AWGN to the


filtered data at the channel

Paramater Definition (Receiver Part)


% First, we transmit the data without noise and demodulate it...
chanOut_noNoise = modOut_Filtered;
chanOut_noNoise_Filtered = rxFilter(chanOut_noNoise);

demodOut_noNoise = qamdemod(chanOut_noNoise_Filtered,
qamModOrder, 'OutputType', 'bit', ...
'UnitAveragePower', true); % QAM Demodulation with average power scaled to
1

% Then, we transmit the data with noise and demodulate it...


chanOut_Noise = modOut_Noise;
chanOut_Noise_Filtered = rxFilter(chanOut_Noise);

demodOut_Noise = qamdemod(chanOut_Noise_Filtered,
qamModOrder, 'OutputType', 'bit', ...
'UnitAveragePower', true); % QAM Demodulation with average power scaled to
1

Plotting the Eye Diagram


eyeDiagram_Period = 2;
eyediagram(real(modOut_Filtered), 2*samplesPerSymbol, eyeDiagram_Period,
0, 'y--');
title('Ideal Eye Diagram (16-QAM, No Noise)');

eyediagram(real(modOut_Noise), 2*samplesPerSymbol, eyeDiagram_Period,


0, 'y--');
title('Eye Diagram With Noise (16-QAM)');

2
Assignment 4: Simulate a Basic
Digital Communications Link

Published with MATLAB® R2023a

3
University of Kufa 12th – Apr – 2024

Assignment 4: Simulate a Basic Digital


Communications Link
Haider Hasan Hamood // 3rd Stage -Morning Study-
ECE // University of Kufa

Simulink System

Fig. 1: Simulink System

Page | 1 Computer Aided Comm. Systems Design


University of Kufa 12th – Apr – 2024

Results
Before Filtering
Constellation Diagram

Fig. 2: Constellation diagram (Without Noise)

Fig. 3: Constellation diagram (With Noise, SNR = 20dB)

Page | 2 Computer Aided Comm. Systems Design


University of Kufa 12th – Apr – 2024

Eye Diagram

Fig. 4: Eye diagram (Without Noise)

Fig. 5: Eye diagram (With Noise, SNR = 20dB)

Page | 3 Computer Aided Comm. Systems Design

You might also like