+1
elbet birine lazım olur birgün, yardım olsun die koyuyorum.
not:matlab kodları amk
close all;clear all;clc;
i=0:10000;
lng=10000;
w=sin(i*pi./2);
s=0.4*sin(i*pi./3);
x=w+s;
M=input('please set the filter length:... '); %filter length
N=length(x); %length of input signal
h=zeros(M,1);
e=ones(1,M);
% x1=zeros(M,1);
y=zeros(1,N);
Px=(1./(1+N)).*sum(x.^2); %power of input signal
delta=1./(100.*M.*Px);
k=1:M;
for n=M+1:N
for k=1:M;
h(k,1)=h(k)+delta.*e(n-1).*x(n-k);
%x1(k,1)=x(n-k);
end
%h1=h.';
d=conv(h,w);
e(n)=w(n)-d(n);
y(n)=x(n)-d(n);
end
subplot(5,1,1);plot(i,x);axis([0,lng,-1.2,1.2]);title('input sgn')
subplot(5,1,2);plot(y);axis([0,lng,-2,2]);title('output')
subplot(5,1,3);plot(e);axis([0,lng,-1,1.1]);title('error')
subplot(5,1,4);plot(i,w);axis([0,lng,-1.2,1.2]);title('mother sgn')
subplot(5,1,5);plot(i,s);axis([0,lng,-1,1]);title('fetus sgn')
figure
subplot(4,1,1);plot(y)
subplot(4,1,2);plot(e)
subplot(4,1,3);plot(s)
subplot(4,1,4);plot(y,'b');hold on;plot(s,'y')
kodların son hali değil daha da efektif hale getirilebilir. ayrıca yorum yazmaya üşendim amk haftaya poster sunumu için bu kodu düzenleriz, lazım olcak birine verebilirim. hadi kolay gele.
not:ccc inci giber ccc