# State space physical meaning

Let $$T(s)$$ be a transfer function that describes a mechanical system, where the input is force and the output is position. And let $$[A,B,C,D]$$ be the equivalent state-space representation of $$T(s)$$, where: $$\dot{x}(t) = Ax(t) + Bu(t) \\ y(t) = Cx(t) + Du(t)$$ and let $$[A_d,B_d,C_d,D_d]$$ be the discretized model of $$T(s)$$, using zero-order hold on the inputs: $$x_d(k+1) = A_dx_d(k) + B_du(k) \\ y(k) = C_dx_d(k) + D_du(k)$$

I know there are infinite possible realizations of $$[A,B,C,D]$$ that represent the same transfer function $$T(s)$$.

1. How can I force the state vector, $$x(t)$$, to have a simple physical meaning? in this example, since it is a mechanical system, the elements of the state vector $$x(t)$$ would probably be position, velocity and acceleration. I can guess the matrix $$A$$ must have this form: $$A = \left[\begin{array}{ccc} * & * & * \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{array}\right]$$ to express the derivative relationship between the state vector elements.
2. Same question, but for the discrete time case: How can I force the state vector, $$x_d(k)$$, to have a simple physical meaning? In this case, I'm not sure how "velocity" and "acceleration" can be expressed.

## 2 Answers

As you pointed out, there are many state-space realizations of one particular transfer function. The reason is that a transfer function only represents the input-output behavior of a system (observable and controllable dynamics) and not the internal states.

That being said, you can directly write state-space realizations from a transfer function with the so-called vertical and horizontal companion forms (equivalently, the observable and controllable canonical forms). The problem is that the physical meaning of the states is not usually guaranteed.

So unless you have a model of your system in terms of differential equations (first principle modeling like Newton's laws or Lagrangian mechanics for mechanical systems), the physical meaning of the states will usually not be accessible. The same holds in the discrete-time domain.

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $$m \ddot x = f_v(\dot x) + f_p(x)$$. For a mass-spring-damper system, it'd be $$m \ddot x = b \dot x + k x$$.

So you can easily express that as a 2nd-order state space equation where $$\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $$A_d = e^{A T_s}$$, $$B_d = A^{-1}(e^{A T_s} - I)$$, and $$C_d = C$$. This gets into obvious numerical difficulties when $$A$$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $$A$$ is singular. I can't speak for the other two, but Scilab uses the identity.

$$e^{\begin{bmatrix} A & B \\ 0 & 0 \end{bmatrix}T_s} = \begin{bmatrix} A_d & B_d \\ 0 & I \end{bmatrix}$$