kalman function from Control System Toolbox™ missing Nu value
조회 수: 4 (최근 30일)
이전 댓글 표시
For some strange reason the kalman function doesn't work on my MATLAB 2008b even with examples from the MATLAB documentation it fails
??? Undefined function or variable
'Nu'.
Error in ==> ss.kalman at 136
known = 1:Nu;
After editing the kalman function I discovered that the Nu variable isn't initialized but it's used many times on the code, thus the error.
Can someone with the Control System Toolbox™ check it out?
Example — Designing an LQG Servo Controller , this is from MATLAB 2008b documentation, it should work but it doesn't because of the missing Nu initialization on the kalman function.
A = [0 1 0;0 0 1;1 0 0];
B = [0.3 1;0 1;-0.3 0.9];
G = [-0.7 1.12; -1.17 1; .14 1.5];
C = [1.9 1.3 1];
D = [0.53 -0.61];
H = [-1.2 -0.89];
sys = ss(A,[B G],C,[D H])
%Construct the optimal state-feedback gain using the given cost function by typing the following commands:
nx = 3; %Number of states
ny = 1; %Number of outputs
Q = blkdiag(0.1*eye(nx),eye(ny));
R = [1 0;0 2];
K = lqi(ss(A,B,C,D),Q,R)
%Construct the Kalman state estimator using the given noise covariance data by typing the following commands:
Qn = [4 2;2 1];
Rn = 0.7;
kest = kalman(sys,Qn,Rn);
%Connect the Kalman state estimator and the optimal state-feedback gain to form the LQG servo controller by typing the following command:
trksys = lqgtrack(kest,K)
댓글 수: 2
Craig
2011년 7월 20일
Hi Paulo,
I ran the code you posted in MATLAB version R2008b and it ran to completion fine. The variable Nu is initialized on line 101 of ss/kalman
Nu = md-Nw;
>> edit ss.kalman %to bring up the kalman function in the editor.
Can you verify that this is in your version?
채택된 답변
Craig
2011년 7월 21일
Hi Paulo,
I ran the code you posted in MATLAB version R2008b and it ran to completion fine. The variable Nu is initialized on line 101 of ss/kalman
Nu = md-Nw;
>> edit ss.kalman %to bring up the kalman function in the editor.
Can you verify that this is in your version?
댓글 수: 1
Sean de Wolski
2011년 7월 21일
Confirmed 2009b:
>>edit kalman
Lines 98:101
% Validate Qn,Rn,Nn
[Nw,Nw2] = size(qn);
[Ny,Ny2] = size(rn);
Nu = md-Nw;
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!