doesnt make any sense plot (RLS) !!
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 View Data During Simulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!