The inverted pendulum on a cart is a classic control theory problem for demonstrating control of an inherently unstable system. Left to its own devices, an inverted pendulum will always fall away from the centre. The cart is controllable however and can move either left or right in order to stabilise the motion of the pendulum and keep it balanced in the centre. There are many examples of this type of system in engineering from balancing rockets using gimbals to balancing a human being on a Segway. The simplified pendulum model consists of a cart with mass M and propelled by a force F in addition to a mass m at the end of a rod. The carts motion is restricted to only moving in…