I'm working on building an LQR for a system which consists of a ball in a vertical tube, a fan is situated at the bottom of the tube and a distance sensor is at the top, a raspberry Pi is used to send a PWM signal to the fan which can be supplied with 0-5 Volts. The idea is that the user can set the desired height of the ball and the fan will lift it up the the desired height. I have two equations which I combined to get the ball dynamics in terms of voltage supplied, my maths can be seen below: enter image description here

I have the simulation working in MATLAB but I've gotten stuck in a rut with grasping what the "U" control signal actually refers to in the physical system, I want to believe that the "U" term in the state space model is the voltage supplied to the fan but I've received other opinions that this isn't the case and that the "U" signal being produced by the LQR calculations is somewhat arbitrary and is to be converted for interpretation by the Pi with a multiplier of "5/255" (which is referring to the resolution that the Pi can receive the signal in). The main reason for this question is I have to ensure that the 0-5 Volts saturation limit is adhered to by the LQR and am unsure as to how to achieve this. So in this case, is the "U" term in the state space model exactly equal to the required supply voltage, or is there something more to consider? Any thoughts are welcome.

Thanks in advance.


1 Answer 1


I've gotten stuck in a rut with grasping what the "U" control signal actually refers to in the physical system

But you've written what it is already!

$$ \dot{x} = Ax + Bu $$

It's whatever the input to your system is. Maybe it's speed, or thrust, or acceleration. It's the thing that is exciting your system.

I'm looking at your equations and I don't think they're correct - you have your input there mapping to $\dot{x_3}$. You are writing that $x_3$ is acceleration, so your input is affecting... Jerk? Is that correct? Typically I would expect to see an x1/x2 that are position and speed, and then the inputs map to the derivative of x2, which is acceleration.

It is very likely that your control output goes to some other system, like a throttle pedal, or a speed regulator, etc. It's up to you to map the signals appropriately and, importantly, the dynamics of the downstream system need to either be negligible or included in the plant model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.