State Space observer Result
Show older comments
Hello everyone,
I have a question about the state space observer, I have programmed a state space space observer using Matlab function block but the result is odd. So if anyone can help I would appreciate it
this is the result of the state estimation.

2 Comments
Sam Chak
on 9 Mar 2022
I think this has nothing to do with the MATLAB function block.
Most likely you have designed a state observer that destabilized the system.
Without showing your work and design, it's very difficult to provide assistance.
Hamidou Youness
on 10 Mar 2022
Answers (1)
Sam Chak
on 11 Mar 2022
Hi @Hamidou Youness
Thanks for adding more info. However, if you are looking for assistance, it is preferred that you share your work or part of your work, rather than relying people to extract data from the pictures. Anyhow, check this out. Your system is both controllable and observable. Now, the observed-state feedback control system is stable. Hope this answer helps!
% state matrix
A = [0 0 1 0; ...
0 0 0 1; ...
0 1.962 0 0; ...
0 5.886 0 0]
% input matrix
B = [0; 0; 0; 0.1]
% output matrix
C = [1 0 0 0]
% desired poles for computing the controller gain matrix K
pc = [-0.5+i -0.5-i -0.75 -1];
K = place(A, B ,pc)
% desired poles for computing the observer gain matrix L
po = [-5+i -5-i -5.5 -6]
L = place(A', C', po)'
% the observed-state feedback control system
sys = ss([A-B*K B*K; zeros(4, 4) A-L*C], eye(8), eye(8), eye(8));
t = 0:0.01:12;
z = initial(sys, [1; 0; 0.5; 0; 0.5; 0; 0.25; 0], t);
x1 = [1 0 0 0 0 0 0 0]*z'; % system states, x
x2 = [0 1 0 0 0 0 0 0]*z';
x3 = [0 0 1 0 0 0 0 0]*z';
x4 = [0 0 0 1 0 0 0 0]*z';
e1 = [0 0 0 0 1 0 0 0]*z'; % error states, e
e2 = [0 0 0 0 0 1 0 0]*z';
e3 = [0 0 0 0 0 0 1 0]*z';
e4 = [0 0 0 0 0 0 0 1]*z';
plot(t, x1, t, x2, t, x3, t, x4, t, e1, t, e2, t, e3, t, e4)
Results:

Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




