0% found this document useful (0 votes)
411 views1 page

Matlab Code For NRZ

This document discusses three non-return-to-zero (NRZ) line coding schemes: unipolar NRZ, polar NRZ, and bipolar NRZ. It generates random binary data, applies each coding scheme to represent the data as voltage pulses, and plots the resulting pulse trains to illustrate each scheme. Unipolar NRZ uses one voltage level to represent 1s and zero voltage for 0s. Polar NRZ uses two voltage levels of opposite polarity. Bipolar NRZ alternates between two voltage levels for 1s and zero for 0s.

Uploaded by

HRISHIKESH E B
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)
411 views1 page

Matlab Code For NRZ

This document discusses three non-return-to-zero (NRZ) line coding schemes: unipolar NRZ, polar NRZ, and bipolar NRZ. It generates random binary data, applies each coding scheme to represent the data as voltage pulses, and plots the resulting pulse trains to illustrate each scheme. Unipolar NRZ uses one voltage level to represent 1s and zero voltage for 0s. Polar NRZ uses two voltage levels of opposite polarity. Bipolar NRZ alternates between two voltage levels for 1s and zero for 0s.

Uploaded by

HRISHIKESH E B
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/ 1

Line Coding Schemes by varying the amlitude of the pulses

%--Non Return to Zero Line Coding Schemes--%


x=round(randi([0 1],1,100))
%--UniPolar NRZ--%
stairs(1:length(x),x)
ylim([-0.2 1.2]);
title('Uni Polar Non Return to Zero');
%--Polar NRZ--%
y=2.*x-1;
figure(2)
stairs(1:length(y),y)
title('Polar Non Return to Zero')
ylim([-1.2 1.2]);
%--Bipolar NRZ--%
y=0;
s=0;
for i=1:length(x)
if(x(i)==0)
s=i;
y=[y zeros(1,50)];
elseif(x(i)==1)
y=[y (-1)^s*ones(1,50)];
end
end
figure(3)
stairs(1:length(y),y)
ylim([-1.2 1.2]);
title('Bipolar Non Return to Zero')

You might also like