看板 Likihon_LAB 關於我們 聯絡資訊
%input sequence x=8*rand(1,100)-4; for i=1:100 if x(i)>=0 xn(i)=1; else xn(i)=-1; end end clear x i % channel output vn=0.1*randn(1,100); %noise h=[0.25 1 0.25]; %channel response u=conv(xn,h);u(1:2)=[]; un=u+vn; % RLS parameter w=zeros(21,1); p=(1/0.005)*eye(21); lunda=1; % RLS algorithm for n=1:1000 %filter input for k=1:21 v=rem(n+21-k,100); if v==0 um(k)=un(100); else um(k)=un(v); end end % desire output if rem(n+20,100)==0 d=xn(100); else d=xn(rem(n+20,100)); end %=========RLS========= pin=p*um'; k=pin/(lunda+um*pin); ita=d-um*w; w=w+k*ita; p=(1/lunda)*p-(1/lunda)*k*um*p; end stem(w) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.21.79
w051:就醬~自己COPY過去用 01/09 18:16