Inverted Pendulum on a Cart -- Nonlinear State Space equations

1 reply · 4K views · last reply
elecboss
Messages
1
Reaction score
0
Hi good day. I am trying to find the general Inverted Pendulum on a cart nonlinear state space equations with two degrees of freedom with x, x_dot, theta, theta_dot which represents displacement, velocity, pendulum angle from vertical, angular velocity. However from research, I am seeing different state space equations. In the image attached is Matlab code I found that gives the proper functionality but I am not sure how it was derived.
y-state
m-mass of the pendulum
M- mass of the cart
L- length of pendulum line
g- gravity
d- friction
u- force on cart
The other image shows the closest set of equations I found but I am unsure. Please help thank you.

MATLAB function cartpend(y,m,M,L,g,d,u) computing dy: Sy = sin(y(3)), Cy = cos(y(3)), D = m*L*L*(M+m*(1-Cy^2)), with dy(1)=y(2), dy(2) and dy(4) nonlinear expressions, dy(3)=y(4).
Four nonlinear state equations written as x1 dot = x dot = x2, x2 dot = x double dot = fraction with numerator -mg sin x3 cos x3 + ml x4^2 sin x3 + f0 m x4 cos x3 + F over M + (1 - cos^2 x3) m, x3 dot = theta dot = x4, and x4 dot = fraction with numerator (M + m)(g sin x3 - f0 x4) - (l m x4^2 sin x3 + F) cos x3 over l(M + (1 - cos^2 x3) m).
 
Attachments
  • MATLAB function cartpend(y,m,M,L,g,d,u) computing dy: Sy = sin(y(3)), Cy = cos(y(3)), D = m*L*L*(M+m*(1-Cy^2)), with dy(1)=y(2), dy(2) and dy(4) nonlinear expressions, dy(3)=y(4).
    ss.JPG
    15.5 KB · Views: 918
  • Four nonlinear state equations written as x1 dot = x dot = x2, x2 dot = x double dot = fraction with numerator -mg sin x3 cos x3 + ml x4^2 sin x3 + f0 m x4 cos x3 + F over M + (1 - cos^2 x3) m, x3 dot = theta dot = x4, and x4 dot = fraction with numerator (M + m)(g sin x3 - f0 x4) - (l m x4^2 sin x3 + F) cos x3 over l(M + (1 - cos^2 x3) m).
    ss2.JPG
    11.4 KB · Views: 1,298