0% found this document useful (0 votes)
29 views2 pages

Untitled

This document defines variables and arrays to simulate different digital modulation techniques. It generates a clock signal, encodes data bits using various return-to-zero (RZ) and non-return-to-zero (NRZ) techniques, and plots the results for comparison. The techniques include unipolar NRZ (UNRZ), bipolar NRZ (BNRZ), unipolar RZ (URZ), and bipolar RZ (BRZ).

Uploaded by

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

Untitled

This document defines variables and arrays to simulate different digital modulation techniques. It generates a clock signal, encodes data bits using various return-to-zero (RZ) and non-return-to-zero (NRZ) techniques, and plots the results for comparison. The techniques include unipolar NRZ (UNRZ), bipolar NRZ (BNRZ), unipolar RZ (URZ), and bipolar RZ (BRZ).

Uploaded by

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

Rb=1000;

data=[0 1 1 0 1 0 ];
v=2;
n=length(data);
Tb=1/Rb;
Ts=Tb/100;
t=0:Ts:Tb-Ts;
T=0:Ts:n*Tb-Ts;
cpulse=[ones(1,length(t)/2) zeros(1,length(t)/2)];
clock=[];
for i=1:n
clock=[clock cpulse];
end
dataplot0=zeros(1,length(t));
dataplot1=ones(1,length(t));
dataplot=[];

UNRZ0=zeros(1,length(t));
UNRZ1=v*ones(1,length(t));
UNRZ=[];

BNRZ0=-v*ones(1,length(t));
BNRZ1=v*ones(1,length(t));
BNRZ=[];

URZ0=zeros(1,length(t));
URZ1=[v*ones(1,length(t)/2) zeros(1,length(t)/2)];
URZ=[];

BRZ0=[ -v*ones(1,length(t)/2) zeros(1,length(t)/2)];


BRZ1=[v*ones(1,length(t)/2) zeros(1,length(t)/2)];
BRZ=[];

for i=1:n
if data(i)==0
dataplot=[dataplot dataplot0];
UNRZ=[UNRZ UNRZ0];
BNRZ=[BNRZ BNRZ0];
URZ=[URZ URZ0];
BRZ=[BRZ BRZ0];
else
dataplot=[dataplot dataplot1];
UNRZ=[UNRZ UNRZ1];
BNRZ=[BNRZ BNRZ1];
URZ=[URZ URZ1];
BRZ=[BRZ BRZ1];
end
end

subplot(6,1,1)
plot(T,clock,'linewidth',5)
grid on
axis([0 n*Tb-Ts -0.2 1.1*v])
xlabel('Time axis ','fontsize',15)
ylabel('clock ','fontsize',15)
subplot(6,1,2)
plot(T,dataplot,'linewidth',5)
grid on
axis([0 n*Tb-Ts -1.1*v 1.1*v])
xlabel('Time axis ')
ylabel('data bits ')

subplot(6,1,3)
plot(T,UNRZ,'linewidth',5)
grid on
axis([0 n*Tb-Ts -1.2*v 1.1*v])
xlabel('Time axis ')
ylabel('UNRZ ')

subplot(6,1,4)
plot(T,BNRZ,'linewidth',3)
grid on
axis([0 n*Tb-Ts -1.2*v 1.1*v])
xlabel('Time axis ')
ylabel('BNRZ ')

subplot(6,1,5)
plot(T,URZ,'linewidth',5)
grid on
axis([0 n*Tb-Ts -1.2*v 1.1*v])
xlabel('Time axis ')
ylabel('URZ ')

subplot(6,1,6)
plot(T,BRZ,'linewidth',3)
grid on
axis([0 n*Tb-Ts -1.2*v 1.1*v])
xlabel('Time axis ')
ylabel('BRZ ')

You might also like