How to Design a Full Order Observer in MATLAB?

358 ビュー (過去 30 日間)
Nick M.
Nick M. 2019 年 4 月 1 日
コメント済み: Rik 2020 年 12 月 7 日
Hi, i was wondering what is the proper way to design a full order observer in MATLAB given the state space matrices: A,B,C,D from x_dot=Ax+Bu. Do you have to use the estim, place, reg commands in MATLAB. If so, how do you use them together? An example would be extremely helpful.

回答 (1 件)

Aquatris 2019 年 4 月 1 日
編集済み: Aquatris 2019 年 4 月 1 日
place() function is for controller design not related to observers. The function finds a state feedback control law, u = Kx, such that eigenvalues of the closed loop system eig(A-B*K) are placed at the desired values. One usually needs an observer to achieve the state information x, that might me why you might be confused about that.
reg() function combines the observer design and controller design procedures. I am not familiar with the function so I am not so sure on what criteria it uses for the controller design.
For just observer design, I prefer to use kalman function. Here is a simple example with kalman;
% plant model (can be thought of as single mass-spring-damper)
A = [0 1;-4 -0.2];
B = [0 1]';
C = [1 0];
sys = ss(A,B,C,0);
% design observer gain
Q = 3e4; R = 0.01; % covariance of process and sensor noises,
% system specific values, needs tuning
[kest,L,P] = kalman(sys,Q,R,[]);
% assume model used for observer is identical to the plant
Aobs = A;
Bobs = B;
Cobs = C;
% obtain both plant and observer in a single system called sysNew
% first 2 state are plant states, last 2 states are observer states
Anew = [A zeros(2);
L*C Aobs-L*Cobs]; % output of the plant affects the observer
% states due to the way observers work
%first input to the system with observer is the unknown disturbance,
% which only affects the plant not the observer,
% second input is the control input
% both affect the plant the same way (i.e.,force acting on the mass)
Bnew = [B B
zeros(2,1) Bobs];
% first output is plant output,
% last 2 are observer state estimates
Cnew = [C zeros(1,2);
zeros(2,2) eye(2)];
sysNew = ss(Anew,Bnew,Cnew,0);
% see how well the observer estimates the output under step disturbance
t = 0:1e-3:10;
u1 = 2*cos(5*2*pi*t')+2*cos(1*2*pi*t');+2*cos(.2*2*pi*t');; % disturbance
u2 = zeros(length(t),1); % control input
y = lsim(sysNew,[u1 u2],t);
plot(t,y(:,1),t,y(:,2)) % first state of the observer is the position of the mass
legend('plant output','observer output estimate')
Hope this helps.
  2 件のコメント
Rik 2020 年 12 月 7 日
Comment posted as answer jingzheng fan:






Community Treasure Hunt

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

Start Hunting!

Translated by