//code for diff. manchester signal
clc;
clear;
x=[0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1];
T=length(x);
n=100;
N=2*n*T;
dt=T/N;
pulse=-1;
t=0:dt:T;
y=zeros(1,length(t));
for i=0:(T-1);
if x(i+1)==1
if pulse==1
pulse=-1;
y(i*2*n+1 : (2*i+1)*n)=-1*pulse;
y((2*i+1)*n+1 : (2*i+2)*n)=pulse;
else
pulse=1;
y(i*2*n+1 : (2*i+1)*n)=-1*pulse;
y((2*i+1)*n+1 : (2*i+2)*n)=pulse;
end;
end;
end;
plot(t,y);
axis([0 t(end) -2 2]);
grid on;
title('differential Manchester');
clc;
clear;
x=[0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1];
T=length(x);
n=100;
N=2*n*T;
dt=T/N;
pulse=-1;
t=0:dt:T;
y=zeros(1,length(t));
for i=0:(T-1);
if x(i+1)==1
if pulse==1
pulse=-1;
y(i*2*n+1 : (2*i+1)*n)=-1*pulse;
y((2*i+1)*n+1 : (2*i+2)*n)=pulse;
else
pulse=1;
y(i*2*n+1 : (2*i+1)*n)=-1*pulse;
y((2*i+1)*n+1 : (2*i+2)*n)=pulse;
end;
end;
end;
plot(t,y);
axis([0 t(end) -2 2]);
grid on;
title('differential Manchester');
//end;
//the output is:-
this is the output |
Thank You !