Escolar Documentos
Profissional Documentos
Cultura Documentos
com
www.youtube.com/diegokillemall
13
www.matpic.com
www.youtube.com/diegokillemall
if h(n+1)==0
y=(t<n)-0*(t==n);
else
y=(t<n)+1*(t==n);
end
d=plot(t,y);grid on;
title('Line code UNIPOLAR NRZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('one');
end
n=n+1;
%pause;
end
y=(t==n);
end
d=plot(t,y);grid on
title('Line code UNIPOLAR RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('zero');
%Graficacin de los UNOS (1)
else
if h(n+1)==0
y=(t<n-0.5);
else
y=(t<n-0.5)+1*(t==n);
end
d=plot(t,y);grid on;
title('Line code UNIPOLAR RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('one');
end
n=n+1;
%pause;
end
end
www.matpic.com
www.youtube.com/diegokillemall
function PNRZ(h)
%Example:
%h=[1 0 0 1 1 0 1 0 1 0];
%PNRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=-(t<n)-(t==n);
else
y=-(t<n)+(t==n);
end
d=plot(t,y);grid on;
title('Line code POLAR NRZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('zero');
else
if h(n+1)==0
y=(t<n)-1*(t==n);
else
y=(t<n)+1*(t==n);
end
d=plot(t,y);grid on;
title('Line code POLAR NRZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('one');
end
n=n+1;
%pause;
End
www.matpic.com
www.youtube.com/diegokillemall
y=-(t<n);
end
else
if ami==1
y=(t<n)-(t==n);
else
y=-(t<n)+(t==n);
end
end
d=plot(t,y);grid on;
title('Line code AMI NRZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('one');
end
n=n+1;
%pause;
end
FUNCIN AMINRZ(h)
El cdigo AMI representa los unos
lgico por medio de valores alternadamente
positivos (+V) y negativos (-V). Un cero
lgico (0L) se representa con un nivel de 0 V.
La funcin siguiente simula esta codificacin:
function AMINRZ(h)
%Example:
%h=[1 0 0 1 1 0 1 0 1 0];
%AMINRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
ami=-1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
if ami==1
y=-(t==n);
else
y=(t==n);
end
end
d=plot(t,y);grid on;
title('Line code AMI NRZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('zero');
else
ami=ami*-1;
if h(n+1)==0
if ami==1
y=(t<n);
else
16
www.matpic.com
www.youtube.com/diegokillemall
n=1;
l=length(h);
h(l+1)=1;
ami=-1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
if ami==1
y=-(t==n);
else
y=(t==n);
end
end
d=plot(t,y);grid on;
title('Line code AMI RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('zero');
else
ami=ami*-1;
if h(n+1)==0
if ami==1
y=(t<n-0.5);
else
y=-(t<n-0.5);
end
else
if ami==1
y=(t<n-0.5)-(t==n);
else
y=-(t<n-0.5)+(t==n);
end
end
d=plot(t,y);grid on;
title('Line code AMI RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('one');
end
n=n+1;
%pause;
end
17
www.matpic.com
www.youtube.com/diegokillemall
else
y=(t<n)-2*(t<n-0.5)-1*(t==n);
end
d=plot(t,y);grid on;
title('Line code MANCHESTER');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('zero');
end
n=n+1;
%pause;
end
18
www.matpic.com
www.youtube.com/diegokillemall
REFERENCIAS
COUCH,
L:
Sistemas
de
Comunicacin Anlogos y Digitales.
19