I have designed a Control System and don't know how to implement it.

I have modeled the physical system and have designed the control based on the State Space method.

The state space form is as follows: x' = Ax + Bu; y = Cx;

A, B, and C are matrices, x is the state vector, u is the input vector, and y is the output vector.

I designed the A, B, and C matrices in MATLAB, and want to implement it in C onto a micro-controller.

How do I actually implement my system now?

I am wanting to take two readings from a sensor that is measuring the system I attempting to control, send those two readings into my controller, and send one output back to my system.

I have designed the controller based on the dynamics of the system and techniques that are taught in an undergraduate level Automatic Control Systems class. Do the measured values go into the input vector?

And then I send the previously determined output value back into the system, and repeat for each sample?

  • 4
    \$\begingroup\$ This is way off-topic for dsp.SE. Even the tags say this is a question about programming, and not even programming for signal processing issues either. I vote to close. \$\endgroup\$ Commented Jan 16, 2013 at 2:29
  • 1
    \$\begingroup\$ Digital control systems design is a kind of digital signal processing problem, so I wouldn't close just because the topic is control. \$\endgroup\$
    – Bruce Zenone
    Commented Jan 16, 2013 at 13:18
  • \$\begingroup\$ @BruceZenone Almost anything in this world can be classified as a signal processing problem if one looks hard enough. For example, communications and signal processing techniques are being considered for use in intra-chip communications when data is being transferred from one part of a VLSI chip to another. So, are all engineering issues that arise in the design and manufacture of a VLSI chip on-topic here? \$\endgroup\$ Commented Jan 16, 2013 at 15:02

1 Answer 1


Since you are implementing this system in a micro-controller, you would be better off converting your design from continuous time to discrete time. You are going to need analog to digital converters for you're inputs and digital to analog converters for your outputs. The math should be simple to implement. You're code will be based around a regular loop that samples inputs and updates outputs, not necessarily at the same rate as the system sampling rate. You should make the timing through your control loop something that can be controlled with a parameter of some sort. The dynamics of a discrete time control system are greatly affected by loop timing and delay.

I would recommend the following book: http://jeffreystevens25.blog.com/2012/10/26/online-applied-control-theory-for-embedded-systems/

Have fun!

  • \$\begingroup\$ Wow, Bruce. That book is exactly what I was looking for. Problem solved. THANK YOU. \$\endgroup\$ Commented Jan 19, 2013 at 17:39

Your Answer

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

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