//code for pseudoternary
clc;
clear;
x=[0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1];
T=length(x);
n=200;
N=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)==0
if pulse==1
pulse=-1;
y(i*n+1 : (i+1)*n)=-1;
else
pulse=1;
y(i*n+1 : (i+1)*n)=0;
end;
end;
end;
plot(t,y);
axis([0 t(end) -2 2]);
grid on;
title('Pseudoternery');
//end;
//the output is:-
THANK YOU !
clc;
clear;
x=[0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1];
T=length(x);
n=200;
N=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)==0
if pulse==1
pulse=-1;
y(i*n+1 : (i+1)*n)=-1;
else
pulse=1;
y(i*n+1 : (i+1)*n)=0;
end;
end;
end;
plot(t,y);
axis([0 t(end) -2 2]);
grid on;
title('Pseudoternery');
//end;
//the output is:-
this is the output of given input |
THANK YOU !
No comments:
Post a Comment