Matlab

Páginas: 6 (1467 palabras) Publicado: 24 de mayo de 2012
CAMILO BARRETO CARVAJAL 2011020470

SIMULACIÓN DE CÓDIGOS DE LÍNEA EN MATLAB

FUNCIÓN  UNRZ (h)
El código Unipolar sin retorno a cero representa un 1 lógico (1L) con un nivel de +V durante todo el periodo de bit y un cero lógico (0L)  con un nivel de 0 V durante todo el periodo de bit. La función siguiente simula esta codificación:

h=[1 0 0 1 1 0 1 0 1 0];
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);
else
y=(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('zero');
else
if h(n+1)==0
y=(t<n)-0*(t==n);
elsey=(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

GRAFICA

FUNCIÓN URZ (h)
El código Unipolar con retorno a cero representa un 1 lógico (1L) con un nivel de +V durante la mitad del periodo de bit y un cero lógico (0L)  con un nivelde 0 V durante todo el periodo de bit. La función siguiente simula esta codificación:

clf;
h=[1 0 0 1 1 0 1 0 1 0];
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
    t=n-1:0.001:n;
%Graficación de los CEROS (0)
    if h(n) == 0
        if h(n+1)==0 
            y=(t>n);
        else
            y=(t==n);
        end
    d=plot(t,y);grid on
    title('Line code UNIPOLARRZ');
    set(d,'LineWidth',2.5);
    hold on;
    axis([0 length(h)-1 -1.5 1.5]);
    disp('zero');
%Graficación 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

GRAFICA

FUNCIÓN PNRZ (h)
 El código Polar sin retorno a cero representa un 1 lógico (1L) con un nivel de +V durante todo el periodo de bit y un cero lógico (0L)  con un nivel de - V durante todo el periodo de bit. La función siguiente simula esta codificación:
clf;h=[1 0 0 1 1 0 1 0 1 0];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');endn=n+1;%pause;End |

GRAFICA

FUNCIÓN BRZ (h)
            El código Bipolar con retorno a cero representa un 1 lógico (1L) con un nivel de +V durante la mitad del periodo de bit y un cero lógico (0L)  con un nivel de - V durante la mitad del periodo de bit. La función siguiente simula esta codificación: clf;h=[1 0 0 1 1 0 1 0 1 0];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-0.5)-(t==n);    else        y=-(t<n-0.5)+(t==n);    end    d=plot(t,y);grid on;    title('Line code BIPOLAR RZ');    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-0.5)-1*(t==n);    else        y=(t<n-0.5)+1*(t==n);    end    d=plot(t,y);grid on;     title('Line code BIPOLAR RZ');    set(d,'LineWidth',2.5);    hold on;    axis([0 length(h)-1 -1.5 1.5]);    disp('one');endn=n+1;%pause;End |
GRAFICA

FUNCIÓN AMINRZ (h)
El código AMI representa los unos lógico por medio de valores alternadamente positivos (+V) y negativos (-V). Un cero lógico (0L)  se representa con...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • matlab
  • Matlab
  • Matlab
  • matlab
  • MATLAB
  • MATLAB
  • Matlab
  • Matlab

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS