Comm Lab Expt 8
Comm Lab Expt 8
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:
%--------------------------------------------------------------
------------
n = 0:1:(bit_d*fs)-1;% Discrete time
carr1 = cos(2*pi*(fc/fs)*n);% Carrier wave for one bit duration
Output:
Inference:
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:
%--------------------------------------------------------------
------------
% 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');
Output:
Inference:
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)
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');
Output:
Inference:
Inference:
Evaluation:
Attendance (2)
Journal (3)
Conduction (5)
Viva (5)
Total (15)
Signature of faculty-in-charge with date