[求助]菜鸟求助,急!RLS算法
<P>下面的算法错在哪里?怎么改?毕业设计急需。万谢。。。英雄救救我吧<br><br>% RLS 算法 <br>randn('state',sum(100*clock)) ;<br>rand('state',sum(100*clock)) ;</P><P>NoOfData = 5000 ; % Set no of data points used for training <br>Order = 6 ; % Set the adaptive filter order </P>
<P>Lambda = 1 ; % Set the forgetting factor <br>Delta = 0.004 ; % R initialized to Delta*I </P>
<P>x = randn(NoOfData,1) + i*randn(NoOfData,1); % Input assumed to be white <br>h = randn(Order, 1)+ i*randn(Order, 1) ; % System picked randomly <br>h = h/max(h);%normalize channel<br>d = filter(h, 1, x) ; % Generate output (desired signal) </P>
<P>% Initialize RLS <br>M=6;<br>P = Delta * eye ( Order, Order )+i*Delta * eye ( Order, Order ) ; <br>w=zeros(M,1)+i*zeros(M,1);</P>
<P>% RLS Adaptation </P>
<P>for n = Order : NoOfData ; </P>
<P>u = x(n:-1:n-Order+1) ; <br>pi_ = u' * P ; <br>k = Lambda + pi_ * u ; <br>K = pi_'/k; <br>e(n) = d(n) - w' * u ; <br>w = w + K * u * conj(e_lms(n)) ;<br>PPrime = K * pi_ ; <br>P = ( P - PPrime ) / Lambda ; <br>end ; </P>
<P>% Plot results </P>
<P>figure ; <br>semilogy((abs(e)).^2) ; <br>title('Learning Curve') ; <br>xlabel('Iteration Number') ; <br>ylabel('Output Estimation Error in dB') ; </P>
[此贴子已经被作者于2006-6-5 19:00:27编辑过]
我是把happy教授一篇转贴改了一下,不过一改就不能运行了。郁闷
页:
[1]