0% found this document useful (0 votes)
31 views14 pages

Comm Lab Expt 8

The document describes implementing digital modulation techniques such as ASK, FSK and PSK in MATLAB. It provides algorithms and MATLAB scripts for each technique. The scripts generate modulated signals and plot the digital data, unmodulated carrier and modulated carrier waveforms.

Uploaded by

Asif Mulla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views14 pages

Comm Lab Expt 8

The document describes implementing digital modulation techniques such as ASK, FSK and PSK in MATLAB. It provides algorithms and MATLAB scripts for each technique. The scripts generate modulated signals and plot the digital data, unmodulated carrier and modulated carrier waveforms.

Uploaded by

Asif Mulla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Karnatak Law Society’s

Gogte Institute of Technology, Udyambag, Belagavi


Department of Electronics and Communication Engineering

Experiment No: 8 Date:


Title: Digital modulation Techniques

Objective: To write a MATLAB program to implement the following digital modulation


techniques and analyze the time domain waveforms:

1. Amplitude Shift Keying (ASK)


2. Frequency Shift Keying (FSK)
3. Phase Shift Keying (PSK)

1. Amplitude Shift Keying (ASK)

Algorithm:
1. Assume bit duration in milliseconds (ms)
2. Assume a large carrier frequency “f”.
3. Assume a large sampling rate “fs = 10*f” to simulate continuous time signal.
4. Generate the discrete time vector n for one bit duration.
5. Read the digital data (bit stream)
6. Set the duration of the signal t for entire duration of the bit stream.
7. Encode the digital data (for proper display).
8. Perform ASK modulation.
9. Plot the time domain wave forms of digital data, unmodulated carrier, and modulated
carrier.

MATLAB Script:

% Binary Amplitude Shift Keying:


clear all;close all;clc;

bit_d = 1e-3;% bit duration in sec


fc = 10000;% frequency of the carrier in Hz
fs = 10*fc;% Sampling rate

%--------------------------------------------------------------
------------
n = 0:1:(bit_d*fs)-1;% Discrete time
carr1 = cos(2*pi*(fc/fs)*n);% Carrier wave for one bit duration

digi_data = [1 0 0 1 1 0 1 0];% digital data to be transmitted


carr = repmat(carr1,size(digi_data));% Carrier for entire
duration of the data sequence
t = 0:1/fs:(length(carr)-1)/fs;% time for entire duration of
the data sequence
%--------------------------------------------------------------
------------

22 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

% Encoding the data:


enc_data = [];
for i = 1:length(digi_data)
if(digi_data(i)==1)
enc_data =[enc_data ones(1,length(n))];
else
enc_data =[enc_data zeros(1,length(n))];
end
end
%--------------------------------------------------------------
------------
% Modulation:
s = [];
for i = 1:length(digi_data)
if(digi_data(i)==1)
s = [s carr1];
else
s = [s zeros(1,length(n))];
end
end
%--------------------------------------------------------------
------------
% Plotting the data sequence:
figure(1),subplot(311),plot(t,enc_data,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Digital Data');
%--------------------------------------------------------------
------------
% Plotting the unmodulated carrier:
subplot(312),plot(t,carr,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Unmodulated Carrier');
%--------------------------------------------------------------
------------
% Plotting the modulated carrier, ASK waveform:
subplot(313),plot(t,s,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Modulated Carrier, ASK waveform');

23 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Output:

Students have to attach the output screenshots.

24 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Inference:

25 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

2. Frequency Shift Keying (FSK)

Algorithm:
1. Assume bit duration in milliseconds (ms)
2. Assume a high frequency carrier with frequency “f1” and low frequency carrier with
frequency “f2”.
3. Assume a large sampling rate “fs = 10*f1” to simulate continuous time signal.
4. Generate the discrete time vector n for one bit duration.
5. Read the digital data (bit stream)
6. Set the duration of the signal t for entire duration of the bit stream.
7. Encode the digital data (for proper display).
8. Perform FSK modulation.
9. Plot the time domain wave forms of digital data, unmodulated carrier, and modulated
carrier.

MATLAB Script:

% Binary Frequency Shift Keying:


clear all;close all;clc;
bit_d = 1e-3;% bit duration in sec
f1 = 10000;% frequency of the carrier in Hz
f2 = f1/2;
fs = 10*f1;% Sampling rate
%--------------------------------------------------------------
------------
n = 0:1:(bit_d*fs)-1;% Discrete time
carr1 = cos(2*pi*(f1/fs)*n);% HF Carrier wave for one bit
duration
carr2 = cos(2*pi*(f2/fs)*n);% LF Carrier wave for one bit
duration
digi_data = [1 0 0 1 1 0 1 0];% digital data to be transmitted
carr = repmat(carr1,size(digi_data));% Carrier for entire
duration of the data sequence
t = 0:1/fs:(length(carr)-1)/fs;% time for entire duration of
the data sequence
%--------------------------------------------------------------
------------
% Encoding the data:
enc_data = [];
for i = 1:length(digi_data)
if(digi_data(i)==1)
enc_data =[enc_data ones(1,length(n))];
else
enc_data =[enc_data zeros(1,length(n))];
end
end

26 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

%--------------------------------------------------------------
------------

% Modulation:
s = [];
for i = 1:length(digi_data)
if(digi_data(i)==1)
s = [s carr1];% HF carrier for bit 1
else
s = [s carr2];% LF carrier for bit 0
end
end
%--------------------------------------------------------------
------------
% Plotting the data sequence:
figure(1),subplot(311),plot(t,enc_data,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Digital Data');
%--------------------------------------------------------------
------------
% Plotting the unmodulated carrier:
subplot(312),plot(t,carr,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Unmodulated Carrier');
%--------------------------------------------------------------
------------
% Plotting the modulated carrier, FSK waveform:
subplot(313),plot(t,s,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Modulated Carrier, FSK waveform');

27 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Output:

Students have to attach the output screenshots.

28 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Inference:

29 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

3. Phase Shift Keying (PSK)

Algorithm:
1. Assume bit duration in milliseconds (ms)
2. Assume a large carrier frequency “f”.
3. Assume a large sampling rate “fs = 10*f” to simulate continuous time signal.
4. Generate the discrete time vector n for one bit duration.
5. Read the digital data (bit stream)
6. Set the duration of the signal t for entire duration of the bit stream.
7. Encode the digital data (for proper display).
8. Perform PSK modulation.
9. Plot the time domain wave forms of digital data, unmodulated carrier, and modulated
carrier.

MATLAB Script:
% Binary Phase Shift Keying:
clear all;close all;clc;
bit_d = 1e-3;% bit duration in sec
f = 10000;% frequency of the carrier in Hz
fs = 10*f;% Sampling rate
%--------------------------------------------------------------
------------
n = 0:1:(bit_d*fs)-1;% Discrete time bit duration
carr1 = cos(2*pi*(f/fs)*n);% Carrier wave for one bit duration
digi_data = [1 0 0 1 1 0 1 0];% digital data to be transmitted
carr = repmat(carr1,size(digi_data));% Carrier for entire
duration of the data sequence
t = 0:1/fs:(length(carr)-1)/fs;% time for entire duration of
the data sequence
%--------------------------------------------------------------
------------
% Encoding the data:
enc_data = [];
for i = 1:length(digi_data)
if(digi_data(i)==1)
enc_data =[enc_data ones(1,length(n))];
else
enc_data =[enc_data zeros(1,length(n))];
end
end
%--------------------------------------------------------------
------------
% Modulation:
s = [];
for i = 1:length(digi_data)

30 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

if(digi_data(i)==1)
s = [s carr1];%Phase 0 degree for bit 1
else
s = [s -carr1];%Phase 180 degree for bit 0
end
end
%--------------------------------------------------------------
------------
% Plotting the data sequence:
figure(1),subplot(311),plot(t,enc_data,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Digital Data');
%--------------------------------------------------------------
------------
% Plotting the unmodulated carrier:
subplot(312),plot(t,carr,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Unmodulated Carrier');
%--------------------------------------------------------------
------------
% Plotting the modulated carrier, BPSK waveform:
subplot(313),plot(t,s,'linewidth',2);
xlabel('time in sec');
ylabel('Amplitude');
title('Modulated Carrier, BPSK waveform');

31 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Output:

The red circled areas indicate phase reversal by 180 degrees.


Students have to attach the output screenshots.

32 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Inference:

33 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Space for MATLAB Script (Open Ended):

34 | Principles of Communication Systems Lab 21EC44 2022-23


Karnatak Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Inference:

Evaluation:
Attendance (2)
Journal (3)
Conduction (5)
Viva (5)
Total (15)
Signature of faculty-in-charge with date

35 | Principles of Communication Systems Lab 21EC44 2022-23

You might also like