Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from dsp.stackexchange.com Jan 16 '13 at 18:33

This question came from our site for practitioners of the art and science of signal, image and video processing.

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. – Dilip Sarwate Jan 16 '13 at 2:29
Digital control systems design is a kind of digital signal processing problem, so I wouldn't close just because the topic is control. – Bruce Zenone Jan 16 '13 at 13:18
@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? – Dilip Sarwate Jan 16 '13 at 15:02

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!

share|improve this answer
Wow, Bruce. That book is exactly what I was looking for. Problem solved. THANK YOU. – Cosmo Kramer Jan 19 '13 at 17:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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