Regulate an Inverted Pendulum

In this classic control systems problem, a controller is designed to stabilize a system about an unstable equilibrium. The inverted pendulum is linearized about the vertical position. StateFeedbackGains gives a matrix, which can be thought of as a controller, that places the poles of the system in the left half of the complex plane. The closed-loop system is then simulated twice.

    
Compute the state feedback gains to regulate an inverted pendulum about the upright position:
In[19]:=
Click for copyable input
In[21]:=
Click for copyable input
Out[21]=
Displacements and of the cart and the pendulum from an initial cart position of :
In[22]:=
Click for copyable input
Out[22]=
The displacements are also regulated when disturbances are present:
In[23]:=
Click for copyable input
Out[23]=
New to Mathematica? Find your learning path »
Have a question? Ask support »