You are on page 1of 4

ARKAJYOTI SAHA 18BEC0938

NRZ UNIPOLAR

%NRZ UNIPOLAR
N=6;
n=[1 0 1 0 1 0];
%UNIPOLAR MAPPING
for m=1:N
if n(m)==1
nn(m)=1;
else
nn(m)=0;
end
end
%NRZ PULSE SHAPING
i=1;
t=0:.01:length(n);
for j=1:length(t)
if t(j)<=i
y(j)=nn(i);
else
i=i+1;
end
end
plot(t,y)
NRZ UNIPOLAR

%NRZ POLAR
N=6;
n=[1 0 1 0 1 0];
%POLAR MAPPING
for m=1:N
if n(m)==0
nn(m)=-1;
else
nn(m)=1;
end
end
%NRZ PULSE SHAPING
i=1;
t=0:.01:length(n);
for j=1:length(t)
if t(j)<=i
y(j)=nn(i);
else
i=i+1;
end
end
plot(t,y)
axis([0 N -2 2]);
NRZ BIPOLAR

%NRZ BIPOLAR
N=6;
n=[1 0 1 0 1 0];
%BIPOLAR MAPPING
f=1;
for m=1:N
if n(m)==1
if f==1
nn(m)=1;
f=-1;
else
nn(m)=-1;
f=1;
end
else
nn(m)=0;
end
end
%NRZ PULSE SHAPING
i=1;
t=0:.01:length(n);
for j=1:length(t)
if t(j)<=i
y(j)=nn(i);
else
i=i+1;
end
end
plot(t,y)
axis([0 N -2 2]);

You might also like