using linear observer on a nonlinear model
5 views (last 30 days)
Show older comments
I'm trying to use a linear luenberger observer
to approximate the motion of an inverted pendulum on a cart grpahically with ODE45:
With states θ and
and controller baed on the estimated states:
. The controller was designed from linearisation about
,
. The dynamics of my true state and estimated state should converge when the released from an initial displacement near π but this isn't happening. The code is:
A=[0 1; 1 0];
B=[0; 1];
C=[1 0];
T0=pi+0.1; %The initial angle of displacement
s1=[-1,-2]; %poles for the true dynamics
s2=[-2,-4]; %poles for the observer
K=place(A,B,s1)
L=place(A',C',s2)'
f= @(t,x) [x(2); -sin(x(1))+[K(1,1)*(x(3)-pi)+K(1,2)*x(4)]*cos(x(1))
;L(1,1)*(x(1)-pi)-L(1,1)*(x(3)-pi)+x(4);
L(2,1)*(x(1)-pi)+(1-L(2,1)-K(1,1))*(x(3)-pi)-K(1,2)*x(4)];
[t,x]= ode45(f,[0 20],[T0 0 0 0]);
plot(t,x(:,1),t,x(:,3),'--')
Where x(1) is θ, x(2) is
, x(3) is
and x(4) is
. The ODE45 was obatined from:
$\begin{bmatrix} \dot{x} \\ \dot{\hat{x}} \end{bmatrix} = \begin{bmatrix} A & -BK \\ LC & A-LC-BK \end{bmatrix} \begin{bmatrix} x \\ \hat{x} \end{bmatrix}$
0 Comments
Answers (0)
See Also
Categories
Find more on Linearization 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!