Unable to produce desired results using state-space model with observer for inverted pendulum

Click For Summary
SUMMARY

The forum discussion centers on the implementation of a state-space observer for an inverted pendulum using MATLAB. The user defines system parameters such as mass, gravitational constant, and pendulum length, and constructs state-space matrices A, B, C, and D. The observer gain is calculated using the 'place' function, but the user encounters issues producing the desired results. The discussion highlights the importance of correctly configuring the observer and state-space representation to achieve accurate system behavior.

PREREQUISITES
  • Understanding of state-space representation in control systems
  • Familiarity with MATLAB and its control system toolbox
  • Knowledge of observer design techniques, specifically the 'place' function
  • Basic concepts of inverted pendulum dynamics
NEXT STEPS
  • Explore MATLAB's 'ss' function for state-space system representation
  • Learn about observer design and stability analysis in control systems
  • Investigate the effects of pole placement on system dynamics
  • Review examples of inverted pendulum control strategies in MATLAB
USEFUL FOR

Control engineers, MATLAB users, and students studying dynamic systems who are working on state-space models and observer design for control applications.

e0ne199
Messages
56
Reaction score
5
TL;DR
I am unable to produce desired results using state-space model with observer for inverted pendulum
Hello everyone, I am trying to make a state-space observer of inverted pendulum using this code :
% Parameters of the system
M = 1.0; % Mass of the cart
m = 0.1; % Mass of the pendulum
g = 9.81; % Gravitational constant
l = 0.6; % Length of the pendulum

%for state-space block on top
A_ = [0 1 0 0;
0 0 -(m*g)/(M - m) 0;
0 0 0 1;
0 0 (g*M)/(l*(M - m)) 0];

B_ = [0;
1/(M - m);
0;
-1/(l*(M - m))];

C_ = eye(4); % Identity matrix as all states can be observed
D_ = [0;0;0;0]; % No direct feedthrough

sys2=ss(A_,B_,C_,D_)

%sys_ctrl = compreal(sys2,"c");

%A_ctrl = sys_ctrl.A
%B_ctrl = sys_ctrl.B
%C_ctrl = sys_ctrl.C
%D_ctrl = sys_ctrl.D

p= [-2 -2.5 -3 -3.5];
K=place(A_,B_,p)
pol= eig(A_-B_*K)

op = [-5 -6 -7 -8];
%op = [-1;-1;-1;-1];
L_mat=place(A_',C_',op)'

%for state-space block on bottom
A_new = A-L_mat*C_;
B_new = [B,L_mat];
C_new=eye(4);
D_new = 0;
sys3=ss(A_new,B_new,C_new,D_new)
and I connect it to this model :
xx.png

but somehow I am only able to produce this result :
zz.png

Do you know what is actually wrong with my code?? any response and help is really appreciated..thanks before
 

Similar threads

Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
4K
  • · Replies 20 ·
Replies
20
Views
5K
  • · Replies 2 ·
Replies
2
Views
7K
  • · Replies 35 ·
2
Replies
35
Views
29K