My system is 4th order:
num = [-0.00198 2]; den = [1 0.1201 12.22 0.4201 2]; sys = tf(num,den); [A, B, C, D] = tf2ss(num,den);
First I have a row vector of poles to get my desired response:
poles = [-2.6 + 1i*2.39, -2.6 - 1i*2.39, -100, -120]; K = acker(A,B,poles) rank(obsv(A,C)); % =4 Mo = rank([C;C*A;C*A^2;C*A^3]) % =4
I then proceed to calculate the plant poles and thus the poles I want for my observer should be around 3x faster.
plant = (A-B*K); poles_cl = eig(plant) poles = 3*poles_cl % THIS IS WRONG des_poles = (min(real(poles_cl))*3)-(1:4); %This is better des_poles = -361.0000 -362.0000 -363.0000 -364.0000
I then proceed to use Ackermann's formula for pole placement using the new poles:
% design observer by placing poles of A-LC at des_poles L=acker(A',C',poles_des)' eig_obs = eig(A-L*C) L = 1.0e+09 * 8.6121 0.1037 0.0005 0.0000 eig_obs = -361.0000 -362.0000 -363.0000 -364.0000
And finally plot. For the observer (software) to give us all the states as output we need to set
C = eye(4):
C = eye(4); mysys=ss(A-L*C,[B L],C,0); %Not sure if this is correct tf(mysys) step(mysys)
Four outputs can be seen:
Following this model for a full state feedback observer:
I am then trying to verify the results on Simulink and am having issue with the block diagram. As can be seen I have two state space models, one for the real plant and one for the observer.
In the below diagram I am comparing state 1, which results in the second graph depicted below.
I am using the base workspace generated by the code above:
Upon running I get an output from the observer which does not track or follow the plant as expected:
Actual and Observer states when comparing state 4 through summing block:
Actual and Observer states when comparing state 1 through summing block:
Any suggestions on why the state I choose to compare via the summing block is effecting the observer estimations would be appreciated.
- Why does the state which I am comparing, effect the observer response?