Documente Academic
Documente Profesional
Documente Cultură
(EL-323)
LABORATORY MANUAL
____________________________________________________________________________________________________________________________________________________________
Lab #
Communication Lab
(EL-323)
of Computer and Emerging Sciences
Islamabad Fall 2017
14
____________________________________________________________________________________
Lab Tasks:-
Lab Task # 01: Binary PAM
Implement Binary PAM on this data:
x = [1 1 1 0 1 0 1 0].
The output of the program should look like as follows: Cosnisider each bit duration is 1 sec. Take “x” as input from
user. The length of “x” can vary.
clc; clear all; close all;
%%%%%%%%%%%%%%% Binary PAM
%%%%%%Transmitter%%%%%%
N=8;
data_bits = [1 1 1 0 1 0 1 0];
% data_bits =rand(1,N)>0.5
samp_sym =2000; % Number of samples per symbol or bit
pulse_bit_1 = ones(1,samp_sym);
pulse_bit_0 = -1*ones(1,samp_sym);
X = [];
for i = 1:N
if data_bits(i)==1
X = [X pulse_bit_1];
Else`
X = [X pulse_bit_0];
end
end
t=linspace(0,N,length(X));
plot(t,X,'linewidth',3)
axis ([0 length(data_bits) -1.2 1.2])
title('Binary PAM','fontsize',12);
xlabel('Time');
ylabel('Amplitude');
grid on;
_____________________________________________________________________________________________
Page 2 of 6
Analogue and Digital National University Roll No: __________
Lab #
Communication Lab
(EL-323)
of Computer and Emerging Sciences
Islamabad Fall 2017
14
____________________________________________________________________________________
x = [0 0 1 1 0 0 1 0].
The output of the program should look like as follows: Cosnisider each bit duration is 1 sec. Take “x” as input from
user. The length of “x” can vary.
_____________________________________________________________________________________________
Page 3 of 6
Analogue and Digital National University Roll No: __________
Lab #
Communication Lab
(EL-323)
of Computer and Emerging Sciences
Islamabad Fall 2017
14
____________________________________________________________________________________
x = [0 1 0 0 ].
The output of the program should look like as follows: Cosnisider each bit duration is 1 sec. Take “x” as input from
user. The length of “x” can vary.
clc; clear all; close all;
data_bits = [0 1 0 0];
samp_sym =2000;
Bit_1 = -ones(1,samp_sym);
Bit_0 = ones(1,samp_sym);
Result = [];
for i = 1:length(data_bits)
if data_bits(i)==1
Result = [Result Bit_1];
else
Result = [Result Bit_0];
end
end
t=linspace(0,length(data_bits),length(Result));
y=cos(2*pi*2*t).*Result;
plot(t,y,'linewidth',2)
ylim([-1.2 1.2])
xlabel('Time');
ylabel('Amplitude');
title('Binary PSK','fontsize',12);
grid on;
_____________________________________________________________________________________________
Page 4 of 6
Analogue and Digital National University Roll No: __________
Lab #
Communication Lab
(EL-323)
of Computer and Emerging Sciences
Islamabad Fall 2017
14
____________________________________________________________________________________
x = [0 1 0 1 0 0 1 1].
The output of the program should look like as follows: Cosnisider each bit duration is 1 sec. Take “x” as input from
user. The length of “x” can vary.
clc; clear all; close all;
%%%%%%%%%%%%%%% Binary FSK Modulation
%%%%%%Transmitter%%%%%%
N=4;
f1=3;
f2=1;
t=linspace(0,1,500);
c1=cos(2*pi*f1*t);
c2=cos(2*pi*f2*t);
data_bits = [0 1 0 0];
% data_bits =rand(1,N)>0.5
X = [];
for i = 1:N
if data_bits(i)==1
X = [X c1];
else
X = [X c2];
end
end
t=linspace(0,N,length(X));
plot(t,X,'linewidth',2)
axis ([0 length(data_bits) -1.2 1.2])
title('Binary FSK','fontsize',12);
xlabel('Time');
ylabel('Amplitude');
grid on;
_____________________________________________________________________________________________
Page 5 of 6
Analogue and Digital National University Roll No: __________
Lab #
Communication Lab
(EL-323)
of Computer and Emerging Sciences
Islamabad Fall 2017
14
____________________________________________________________________________________
_____________________________________________________________________________________________
Page 6 of 6