# How do I determine the output equation in the state-space representation?

In the state space representation, the state equation for a linear time-invariant system is:

$$\dot{\mathbf{x}}(t) = \mathbf{A}\mathbf{x}(t)+\mathbf{B}\mathbf{u}(t)$$

This state equation can be derived by decomposing an $$n^{th}$$ order differential equation into $$n$$ first-order differential equations and then choosing the state variables $$x_1(t),x_2(t),...,x_n(t)$$ and their derivatives $$\dot{x}_1(t),\dot{x}_2(t),...,\dot{x}_n(t)$$. The state equation essentially describes the relationship between the state variables and the inputs in $$\mathbf{u}(t)$$.

Additionally, the output equation for a linear time-invariant system is:

$$\mathbf{y}(t) = \mathbf{C}\mathbf{x}(t)+\mathbf{D}\mathbf{u}(t)$$

However, I am not sure how this output equation is derived. More precisely, what is an "output"? Is it the set of state variables and inputs that need to be observed by the engineer or another system downstream? If that is true, then if I have a mass-spring-damper system, where the displacement of the mass is represented by the state variable $$x_1(t)$$, the velocity of the mass is represented by the state variable $$x_2(t)$$, and an externally applied force on the mass is represented by the input variable $$u_1(t)$$, and I was interested in observing/measuring the displacement of the mass, would my output equation then be:

$$y(t) = x_1(t)$$

Alternatively, if I was interested in observing both the displacement of the mass and the externally applied force, then would my output equation be:

$$\mathbf{y}(t) = \begin{bmatrix} y_1(t) \\ y_2(t) \end{bmatrix} = \begin{bmatrix} x_1(t) \\ u_1(t) \end{bmatrix}$$

So far, neither the state variables nor the inputs have been scaled in my output equation. Because of this, I don't understand the purpose of the $$\mathbf{C}$$ and $$\mathbf{D}$$ matrices. Could they be used to linearly transform the state variables and inputs for another system downstream? From this image on a typical state space representation:

$$\hskip2in$$

It seems that what I am saying is correct, but I would prefer a better explanation.

I am not entirely sure whether your question has to do with C and D matrices, or with how and why to select the output variables. I'll try to tackle both.

Regarding the latter (how and why you decide on the output variables):

You are right, in that for a simple system, there is not much point in developing the $$\mathbf{y}$$ vector and corresponding equation. In terms of logistics, you already have the relevant data.

However, in more complex system you might be interested in the response of only a few of the state variables, or in linear combinations of them.

So I tend to think the $$\mathbf{y}$$ as a way to perform a "boil down to essentials". However, there are other reasons, which I believe you suspect as linear combination of solutions to obtain a transformed solution

Example: think of the following system with two mass springs you can select either the absolute $$x_1$$ and $$x_2$$ displacements of the mass.

Another equivalent representation is $$x_1$$ and $$x_2-x_1$$ (essentially the deformation of the spring). If you are only interested in the deformation of the string you might create a $$C=[1, -1]$$ and you are done. However, it might be easier to see, that it is easier to construct the equations for $$x_1$$ and $$x_2$$ because their odes are similar (while constructring the ode for the spring deformation will be different).

Bottom Line: state representation makes much more sense in more complex systems.

Regarding the use of C and D matrices

The first good reason that comes to mind for the use of C and D matrices, is to perform the Observability and Controlability Tests. Its in the same link you provided wikipedia link.

• Thanks a lot for the explanation! – mhdadk Aug 14 at 15:37