# MATLAB MATLAB/Simulink - inverted pendulum swing-up problem

#### tatenka

I'm trying to implement a pendulum swing-up controller to work with my model of a single inverted pendulum on a cart with a motor (the only input is the motor voltage, the outputs are the cart position and the pendulum velocity). The controller has the form
where theta is the pendulum angle, thetadot is the pendulum angular velocity (derivative of the angle), umax is the maximum voltage and u is the actual input voltage applied to the system. A couple of blocks in Simulink, nothing special, or so it would seem.
I've seen this kind of controller implemented in a variety of sources (http://support.dce.felk.cvut.cz/mediawiki/images/0/08/Bp_2009_korda_milan.pdf pages 19-21) but I'm having a problem with it. To be specific about how the system behaves (see first figure of the attachment):
- the pendulum angle (purple) and angular velocity (thetadot, blue) have the normal sinusoid behavior and the pendulum swings increase (this has been normal behavior so far)
- at one moment, when the pendulum is quite close to the upper equilibrium and thetadot is crossing the zero, thetadot SUDDENLY goes mad and starts oscillating with approximately an amplitude of 1e-4 and period of less than 1e-3 seconds. This means that the controller adopts the same oscillating behavior (second figure of the attachment), and if you change the input voltage of a system (yellow) hundreds of times per second, the system behaves as if there was no input at all
Could anybody help me please?? I have to put this into my thesis and it is starting to drive me mad.

#### Attachments

• 78.3 KB Views: 361
Related Math Software Workshop News on Phys.org

"MATLAB/Simulink - inverted pendulum swing-up problem"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving