doesnt make any sense plot (RLS) !!

1 回表示 (過去 30 日間)
Marwa  Ali
Marwa Ali 2012 年 4 月 27 日
original system:
y(k)=2.7*y(k-1)-1.8*y(k-2)+u(k-1)+5*u(k-2)+6*u(k-3);
it's required to get the parameters using recursive extended least square..so my code is:
%Recursive Extended Least square
u=ScopeData2(:,2);
P=1000*eye(4);
theta=[0 0 0 0]';
y=zeros(500,1);
for k=4:500
y(k)=2.7*y(k-1)-1.8*y(k-2)+u(k-1)+5*u(k-2)+6*u(k-3);
phai=[y(k-1) -y(k-2) u(k-2) u(k-3)]';
P=P-((P*phai*phai')*inv(1+(phai'*P*phai)));
e(k)=y(k,1)-phai'*theta(k-1);
theta=theta+P*phai*e(k);
a1(k)=theta(1);
a2(k)=theta(2);
b1(k)=theta(3);
b2(k)=theta(4);
end
when i run program and plot values of a1,a2,b1,b2..it gives me NAN instead of converges to their true values :S
any help would be greaaaat .
A
  1 件のコメント
Marwa  Ali
Marwa Ali 2012 年 4 月 27 日
u is input signal ...i used square wave!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeView Data During Simulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by