# Problem in selection of state variables of inverted pendulum

I was reading about controller design from the book Control System Design, An Introduction by Bernard Friedland.

In one of the examples of controller design for an inverted pendulum, the author considered two state variables (e.g. angular position and velocity) as shown in the figure.

But to my knowledge for controller design, we have to select minimum number of independent state variables and then connect the gains via feedback to input of motor.

So in my understanding, there should be only one gain (that is connected to gain via feedback to input of motor) because system is a pendulum of some mass so we have only one energy storing element (e.g. mass of pendulum) so we need only one state variable to design controller.

So why does the author take two state variables instead of one for controller design?

• "So in my understanding, there should be only one gain". Which state (position or velocity) should the gain be connected to ? "we have to select minimum number of independent state variables". Can you provide a source for this ? To my knowledge, people add additional states to problems to make it easier to solve. – AJN Sep 28 '20 at 18:05
• @AJN , that's why I asked when we can design controller with 1state variable then why we need 2nd for this problem and how design of controller is easier if we consider two state variables instead of one as you mentioned ? – user215805 Sep 28 '20 at 18:27
• In plain language, what the motor should do depends not only on the position of the mass, but also on its current velocity. So conceptually you need two inputs. There are situations where a single sensor could be used with the derivative of its change in position, but there's still conceptually a velocity input; and practically a "velocity sensor" may give a better signal than the derivative of a potentiometer angular sensor. Or a chip providing both a MEMS gyro (angular velocity) and accelerometers (current angle) might be used. Some angular encoders could do both jobs. – Chris Stratton Sep 28 '20 at 18:50
• @Chris ,so no. Of independent state variables needed for controller design can be more or less than total no. Of independent energy storing elements and total number of gain blocks require is independent of energy storing elements and there is no thumb of rule to just predict the no. Of state variables needed for controller design of any system ? – user215805 Sep 28 '20 at 19:29
• If you're going to talk about energy storage, you might want to think about the actual kinds of energy in the system: both potential and kinetic. But in intuitive terms think about needing to know not only if the bob is in the wrong place, but also if its position is currently getting better or worse; you have to consider not just the snapshot of where it is, but the trend of what it is doing. – Chris Stratton Sep 28 '20 at 19:43

The number of states is a direct correspondence to the order of a system. Referencing wikipedia, the inverted pendulum angle $$\\theta(t)\$$ has the following second order differential equation: $$\frac{d^2\theta(t)}{dt^2}=\frac{g}{l}\sin(\theta(t))$$
For a state-space description, this second-order differential equation would be split in two first-order differential equations. One way to do would be with the following "state choices" (aka "realization"), as used in the question example: $$x_1 = \theta(t)\\ x_2 = \frac{d\theta(t)}{dt} = \omega(t)$$ The first order differential of these states result in: $$\dot x_1 = x_2 \\ \dot x_2 = \frac{g}{l}\sin(x_1)$$
You have now described a second order system using two state variables, such states can be used for state feedback. Be aware the inverted pendulum is a nonlinear system, so you can't find a $$\\dot x=Ax\$$ (where $$\A\$$ is not dependant on $$\x\$$) notation for this system.