I designed a LQR controller and want to implement it on a microcontroller. I don't know about digital control and don't know when to apply it.

After a brief research, I found out that I need to apply the z-Transform, instead of Laplace-Transform. However the gain matrix is derived from time-domain.

The microcontroller I use is a OpenCR1.0.

  • $\begingroup$ Microcontrollers are digital devices. The Laplace Transform is about continuous (analog) signals. Conceptually, the z transform is the digital equivalent of the s Transform for continuous functions but the two are not completely equivalent - for example the s transform (in theory at least) covers an infinite frequency range but the z transform only covers a finite range because of the Nyquist criterion and the sample rate. $\endgroup$
    – alephzero
    Jan 7, 2019 at 18:31
  • $\begingroup$ @alephzero, but when is it necessary to "digitalize" the control law ? I read in a paper, that says : "The controller is implemented on a microcontroller running at 157.8 Hz. This control rate being sufficiently high, discrete control theory can be omitted and the continuous controller designed for the simulation is directly ported." So is it a general rule ? Given a high enough clock rate, I can "omit" digital control laws ? $\endgroup$
    – ganto
    Jan 8, 2019 at 10:05

1 Answer 1


You can also solve the LQR problem for discrete systems instead of continuous. One does needs to solve the DARE instead of CARE. But this does require having a discretized state space model. A simple but bad discetization method would be forward Euler. But there are a lot of other methods out there, such as zero-order-hold, first-order-hold and bilinear-transform/Tustin. In certain situations one method would be preferable over another and a decent overview is given in this YouTube series by Brian Douglas. But at low frequencies they all yield the same response, so if the sample rate is significantly faster than the dynamics of the system then it won't matter much which method you pick.

It can also be noted that it is very likely that the continuous LQR gain you calculated for the continuous system will also work on a digital controller if the absolute values of the closed loop poles lie significantly below the sample frequency. Namely most often zero-order-hold would be a good representation of what the digital controller does. Namely it calculates the controller output and holds it for one sample time. This roughly adds half a sample time delay, which might make the system unstable if the closed loop poles lie close to the sample frequency. But a delay only reduces the phase margin of the controller, but LQR has a guaranteed phase margin of 60°, so should always be able to handle some decent amount of delay. For example when use would use poles placement you would not have this 60° phase margin guarantee. But with LQR the performance might not be as optimal as the LQR designed for the discretized system.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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