%NRZ L, NRZ M, NRZ S coding
Bclock
%100 H? square wave
clear all;
t=0:.001:10;
y=square (1*pi*2*t); samplling freq lKHz
fiqure (1);
subplot (511)
plot (t,y, 'LineWidth',3):
axis([0 10 0 1.0]):
title('clork '):
xlabel('Se.d:"):
ylabel('Am:l itude');
Dat.á
clear all;
warning off;
n=[1 0 10 1 1 0 0 1 0]; data bits
%NRZ pulse shaping
i=1;
t=0:.01:length (n);
for j=1:length(t)
if t(j)<=i
y(j) =n (i);
else
i=i+l;
y(j) =n (i);
end
end
figure (1) ;
subplot (512);
plot (t, y, 'Li newidt h',3);
axis ([0 length (n) -1 2]):
title(' data'):
xlabel('time');
ylabel('Arnplitude'):
NRZ L
X=[1 0 1 0 1 1 0 0 1 0);
2 bits to level rnapping
for ii=l:length (x) ;
if x(ii) ==1;
xl (ii) =1;
else
x1 (ii)=-1;
end
end
NRZ pulse shaping
i-1;
t=0:.01:length (x1) ;
for j=l:length (t)
if t(j) <=i;
y(j)=x1 (i);
else
i=i+l;
yj)=x1 (i);
end
end
figure (1) ;
subplot (513) :
plot (t, y,'Linewidth',3);
axis( [0 length (x1) -2 2]);
title(' NRZ-LFVEI wave form');
xlabel('time');
ylabel('Ampl itude');
$NRZ MARK
Binary Input seguene
n=[1 0 1 0 1 1 0 0 1 0]:;
M(1) =0;
for k=l:length (n)
M(k+1)=xor (M(k),n (k));
end
SBinary to polar CoIversicn
for m=1:length (M)
if M(m) ==0
nn (m)=-1;
else
nn (m) =1;
end
end
3NRZ pul se shaping
i=l;
t=0:.01:length (M) ;
for j=1:length (t)
if t(j) <=i
y(j) =nn(i) ;
else
y(j) =nn (i );
i=i+l;
end
end
figure (1) ;
subplot (514) ;
plot (t, y,'LineWidth',3);
axis( [1, length(M) -2 2]):
title('NR?-MARK waveform');
xlabel ('tine');
ylabel('Ampl itude');
xlabe('time');
title('NRZ-SPACE
waveform');
ylabel("Amplitude'); plot(515)
figure; (1) ;end
axis([1,subplot SNRZ
for Shaping
t=0:.01:length (M) ;Pulse end end
for k=l:length )sequence NRZ
Binary
for(nM(1) n=[1InputSPACE
=0;%Binary
end else i=l;
(t, j=1:length
t(j)<=i if (t) end else if m=
(k+1)=not M 0
y, i=i+l;
y(j)=nny(j)=nn
(i) ; (i) M(m)
==0
=-1;(m)nn
(m)=l;nn 1:length to 1
length
'LineWidth',3) ; 0
polar 1
(M) 1
(M) (xor 0
-2 conversiCn 0
(M(k),n 1
2]): 0];
;
(k)
));