²é¿´: 800  |  »Ø¸´: 5
µ±Ç°Ö÷ÌâÒѾ­´æµµ¡£
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

zzbei

ľ³æ (ÕýʽдÊÖ)

[½»Á÷] ×ÔÊÊÓ¦matlab³ÌÐò£¨LMSºÍRLS£©

%lmsËã·¨Ô´³ÌÐò

clear all
close all
%channel system order
sysorder = 5 ;
% Number of system points
N=2000;
inp = randn(N,1);
n = randn(N,1);
[b,a] = butter(2,0.25);
Gz = tf(b,a,-1);
%This function is submitted to make inverse Z-transform (Matlab central file exchange)
%The first sysorder weight value
%h=ldiv(b,a,sysorder)';
% if you use ldiv this will give h :filter weights to be
h= [0.0976;
0.2873;
0.3360;
0.2210;
0.0964;];
y = lsim(Gz,inp);
%add some noise
n = n * std(y)/(10*std(n));
d = y + n;
totallength=size(d,1);
%Take 60 points for training
N=60 ;  
%begin of algorithm
w = zeros ( sysorder , 1 ) ;
for n = sysorder : N
  u = inp(n:-1:n-sysorder+1) ;
y(n)= w' * u;
e(n) = d(n) - y(n) ;
% Start with big mu for speeding the convergence then slow down to reach the correct weights
if n < 20
mu=0.32;
else
mu=0.15;
end
  w = w + mu * u * e(n) ;
end
%check of results
for n = N+1 : totallength
  u = inp(n:-1:n-sysorder+1) ;
y(n) = w' * u ;
e(n) = d(n) - y(n) ;
end
hold on
plot(d)
plot(y,'r');
title('System output') ;
xlabel('Samples')
ylabel('True and estimated output')
figure
semilogy((abs(e))) ;
title('Error curve') ;
xlabel('Samples')
ylabel('Error value')
figure
plot(h, 'k+')
hold on
plot(w, 'r*')
legend('Actual weights','Estimated weights')
title('Comparison of the actual weights and the estimated weights') ;
axis([0 6 0.05 0.35])

% RLS Ëã·¨
randn('seed', 0) ;
rand('seed', 0) ;

NoOfData = 8000 ;  % Set no of data points used for training
Order = 32 ;    % Set the adaptive filter order

Lambda = 0.98 ;    % Set the forgetting factor
Delta = 0.001 ;    % R initialized to Delta*I

x = randn(NoOfData, 1) ;% Input assumed to be white
h = rand(Order, 1) ;  % System picked randomly
d = filter(h, 1, x) ;  % Generate output (desired signal)

% Initialize RLS

P = Delta * eye ( Order, Order ) ;
w = zeros ( Order, 1 ) ;

% RLS Adaptation

for n = Order : NoOfData ;
   
  u = x(n:-1:n-Order+1) ;
  pi_ = u' * P ;
  k = Lambda + pi_ * u ;
  K = pi_'/k;
  e(n) = d(n) - w' * u ;
  w = w + K * e(n) ;
  PPrime = K * pi_ ;
  P = ( P - PPrime ) / Lambda ;
  w_err(n) = norm(h - w) ;

end ;

% Plot results

figure ;
plot(20*log10(abs(e))) ;
title('Learning Curve') ;
xlabel('Iteration Number') ;
ylabel('Output Estimation Error in dB') ;

figure ;
semilogy(w_err) ;
title('Weight Estimation Error') ;
xlabel('Iteration Number') ;
ylabel('Weight Error in dB') ;

[ Last edited by »ÃÓ°ÎÞºÛ on 2006-10-26 at 07:47 ]
»Ø¸´´ËÂ¥

» ÊÕ¼±¾ÌûµÄÌÔÌùר¼­ÍƼö

source

» ²ÂÄãϲ»¶

¾­Àú¾ÍÊÇÒ»ÖÖÏíÊÜ
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌøת ÎÒÒª¶©ÔÄÂ¥Ö÷ zzbei µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍƼö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] ¸Õ¸ÕÊÕµ½¿ÆÑÐÖ®ÓÑÓʼþ +17 olivermiaoer 2024-06-19 23/1150 2024-06-20 12:25 by liliwang215
[½Ìʦ֮¼Ò] ÊÔÓÃÆÚ´ÇÖ° +10 ZHONGWU_U 2024-06-18 16/800 2024-06-20 11:52 by xiang104
[»ù½ðÉêÇë] F03ÇàÄê»ù½ðº¯ÆÀ½á¹û +3 ôßÑôÒ»Ö»²ñ 2024-06-19 4/200 2024-06-20 11:15 by ôßÑôÒ»Ö»²ñ
[¿¼²©] ¹ØÓÚ¶Á²©¸Ð¾õ×Ô¼ººÜ×¥Âí +9 С¾ÅÔ 2024-06-19 12/600 2024-06-20 11:06 by SCITOPPP
[¾«Ï¸»¯¹¤] ÊÔ¼Á¼Û¸ñ +4 Ðñ±ØÉÏ°¶ 2024-06-17 5/250 2024-06-20 10:52 by Ðñ±ØÉÏ°¶
[½Ìʦ֮¼Ò] ÿ´ÎɧÈÅŮѧÉúµÄ¶¼ÊÇԺϵÁìµ¼£¬¶ø²»ÊÇÆÕͨ½Ìʦ£¬Ð¡±àÃÇҪעÒâ´ë´ÇÕýÈ· +10 zju2000 2024-06-15 12/600 2024-06-20 10:32 by Сľ³æÎâÑå×æ·Ö×
[¿¼²©] 2025Ä격ʿÉêÇ룬¿ÉÏÈ×ö¿ÆÑÐÖúÀí +4 limit888 2024-06-18 7/350 2024-06-20 10:23 by °²ËþÍßÀ­¶à
[´ß»¯] Äø¸ºÔØÑõ»¯ÂÁµÄ±£´æÎÊÌâ 8+3 lwn0130 2024-06-15 6/300 2024-06-20 09:00 by lwn0130
[ÂÛÎÄͶ¸å] Óл¯Ñ§Í¶¸åµÄÆÚ¿¯ÍƼöÂð 20+3 ÈÙСƲ 2024-06-13 4/200 2024-06-20 08:24 by 1975632963
[ÎÄѧ·¼²ÝÔ°] ÀÛ²¢¿ìÀÖ×Å +20 MYHLD521 2024-06-14 20/1000 2024-06-19 23:04 by tentoone
[»ù½ðÉêÇë] F¿ÚÐÅϢѧ²¿ÄÃÃæÉÏ£¬´ó¸ÅÐèҪʲôÑùµÄ³É¹û +7 _·ÜÀè_ 2024-06-16 18/900 2024-06-19 20:02 by _·ÜÀè_
[¿¼²©] 34Ëê¶Á²©Ê¿ÍíÂð +39 emitdne 2024-06-13 39/1950 2024-06-19 19:03 by Dqtjs
[˶²©¼ÒÔ°] ¹ØÓÚ˶²©Á¬¶ÁµÄһЩÒÉÎÊ£¿ +8 Lwenter 2024-06-14 10/500 2024-06-19 10:00 by qingdao001
[»ù½ðÉêÇë] ²©ºó»ù½ðË¢µ½µÄBUG,ͼƬÀ´µÄ¸üÖ±¹Û +15 carolloo 2024-06-17 16/800 2024-06-19 09:42 by msjy
[ÂÛÎÄͶ¸å] Éó¸åÈ˺¬ºý¾Ü¸å£¬»¹ÐèÒª»Ø¸´Âð£¿ÈçºÎ»Ø¸´£¿ 20+4 BruceChum 2024-06-15 22/1100 2024-06-19 08:00 by kanyechris
[¹«Åɳö¹ú] CSCµÂ¹ú²©ºóÿ¸öÔÂ×ÊÖú¶àÉÙѽ£¿¹»ÓÃÂð +4 326lhpqk 2024-06-16 7/350 2024-06-19 02:03 by PLHOU
[¸ß·Ö×Ó] Ñ°ÕÒ¾Ûõ¥·´Ó¦¸ª +3 ÜäÜ乧Öó 2024-06-15 6/300 2024-06-18 14:15 by ÜäÜ乧Öó
[ÂÛÎÄͶ¸å] Ͷ¸åÇóÖú 10+3 2022_Áé»ê¹¤³Ìʦ 2024-06-16 8/400 2024-06-18 12:12 by Ͷ±ØµÃ¿ÆÑйËÎÊ
[ÂÛÎÄͶ¸å] ÂÛÎÄÒѽÓÊÕ£¬µ«·¢ÏÖÐ޸ĸ崫µÄÊǾɰæ¸ÃÔõô°ì£¿ +3 zsq54321 2024-06-15 6/300 2024-06-17 19:45 by wjykycg
[»ù½ðÉêÇë] ²©ºó»ù½ð£¬ÒÔÍùµÄ½á¹ûµã²»¿ª£¬Ôõô»ØÊÂÄØ£¿×îºóÒ»´Î»ú»áÁË£¬Á½´Î¶¼Ã»ÖÐÇ°Ãæ¡£ +7 kyukitu 2024-06-14 13/650 2024-06-15 06:46 by ÎÒÊÇÍõС˧
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û