Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

clc;

n=1000;
t=(0:n-1);
w=.001;phi=.1;
d=sin(2*pi*(1:n)*w+phi);
s=d+randn(1,n)*.5;
c=zeros(1,n);
mu=.02;
for m=1:n;
e(m)=d(n)-c(m)'*s(m);
c(m+1)=c(m)+mu*e(m)*s(1);
end
for m=1:n;
yd(m)=sum(c(m+1)'*s(m));
end
subplot(2,2,1);
plot(t,d);
xlabel('time period');
ylabel('amplitude');
title('input signal');
subplot(2,2,2);
plot(t,s);
xlabel('time period');
ylabel('amplitude');
title('received signal');
subplot(2,2,3);
plot(t,e(m));
xlabel('time period');
ylabel('amplitude');
title('error signal');
subplot(2,2,4);
plot(t,yd(m));
xlabel('time period');
ylabel('amplitude');
title('output signal');

You might also like