%try cosine wave plot also
%a=.5;
pi=3.14;
f=1;
x=[0 0 0 1 1 0 1 1 0 0 1 0 1 1 0 1];
nx=size(x,2);
i=1;
while i<nx+1
t = i:0.001:i+2;
if x(i)==0 && x(i+1)==0
z=sin(2*pi*f*t-3*pi/4);
dibit=0;
elseif x(i)==0 && x(i+1)==1
z=sin(2*pi*f*t-pi/4);
dibit=1;
elseif x(i)==1 && x(i+1)==0
z=sin(2*pi*f*t+pi/4);
dibit=2;
else
z=sin(2*pi*f*t+3*pi/4);
dibit=3;
end
%subplot(2,1,1);
plot(t,dibit,'r');
%grid on;
hold on;
%subplot(2,1,2);
plot(t,z);
hold on;
grid on;
axis([1 20 -3 3]);
i=i+2;
end
No comments:
Post a Comment