Professional Documents
Culture Documents
MATLAB Code For Non Return To Zero Line PDF
MATLAB Code For Non Return To Zero Line PDF
Aimal Rehman
Student BS Telecommunication Engineering,
Department of Electrical Engineering,
CIIT Lahore.
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')