# How to get second derivative of state as a output of state-space model?

Let's say modeling the free-falling object on state-space. Obviously, the equation of motion is a second order differential equation of the vertical position of the object. And one would normally set vertical position "x" and its derivative "x dot" as element of state to configure a state-space model. However, the output is only a linear combination of states(and input). In this case what would be the best option to get "acceleration" or second derivative "x double dot" as an output?

This is quite a basic question, but can't find a good example.

Edit)
Consider a falling ball with vertical force F and positional sensor y. How can I represent an additional acceleration sensor "y_2" on the model below?

$$\begin{matrix} \dot{x} \\ \ddot{x} \end{matrix} = \begin{matrix} 0 & 1 \\ 0 & 0 \end{matrix} *\begin{matrix} x \\ \dot{x} \end{matrix} + \begin{matrix} 0 & 0 \\ 1/m & -1 \end{matrix}*\begin{matrix} F \\ g\end{matrix}$$ $$\begin{matrix} y \end{matrix} = \begin{matrix} 1& 0 \end{matrix}*\begin{matrix} x \\\dot{x} \end{matrix} + 0 *\begin{matrix} F \\ g\end{matrix}$$

• Are you just asking about $F-m\ddot{x}=0$ or $g-\ddot{x}=0$? – jonk May 5 at 1:29
• The derivative is a linear operator. If you take the Laplace transform, you need only multiply X(s) by s^2 to obtain the Laplace transform of x double dot. If you keep things in the time domain, then just use the derivative operator on x dot (d/dt). – LetterSized May 5 at 1:30
• In this particular example, the second derivative of position is given by the original differential equation itself. Adjust the C matrix and the D matrix so that one row of the output equation replicates the original differential equation. – AJN May 5 at 1:36
• In a general case apply a double derivative on the position state or a single derivative on the velocity state as mentioned in the previous comment. – AJN May 5 at 1:38
• @jonk I am interested in both case, but the former seems more general. So, I would say the former. Does it make any difference? – Chanwoo Ahn May 5 at 1:49

An ideal acceleration sensor can be modeled using the original equation itself.

$$a = Cx+ Du = \begin{pmatrix} 0 & 0 \end{pmatrix} \begin{pmatrix} x\\ \dot{x} \end{pmatrix} + \begin{pmatrix} 1/m & -1 \end{pmatrix} \begin{pmatrix} F\\g \end{pmatrix}$$

Attach the above C and D matrices as the second row of the corresponding matrices in your original output equation. The original output equation represented an ideal position sensor. Now the augmented output equation represents a position sensor (Ist row) and an acceleration sensor (IInd row).

$$y_1 = \begin{pmatrix} y\\ a\end{pmatrix} = \begin{pmatrix} 1 & 0\\ 0 & 0 \end{pmatrix} \begin{pmatrix} x\\ \dot{x} \end{pmatrix} + \begin{pmatrix} 0 & 0\\ 1/m & -1 \end{pmatrix} \begin{pmatrix} F\\g \end{pmatrix}$$

The above is for an ideal sensor. If you want to estimate the acceleration, you may need an estimator which uses the measured states and the inputs and outputs an estimate. If you want to model a non ideal sensor, you will need the above equations as well as additional states and inputs to model the bandwidth, bias, noise etc. of the non ideal sensor.

• For any higher derivatives, see this post (written by me). – AJN May 5 at 2:23