doesnt make any sense plot (RLS) !!
1 view (last 30 days)
Show older comments
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
Answers (0)
See Also
Categories
Find more on View Data During Simulation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!