The Relationship Between Transfer Functions and State Space Representations

Living can sometimes feel quite difficult. There are so many things that need to be done, and amidst the pressure, it’s easy to rush, make mistakes, and end up having to redo everything. “Especially when busy, don’t rush. It’s okay to do things quickly, but don’t do them in haste.” Let’s take a moment to breathe, have a cup of tea, and proceed calmly.

Hello, I’m Hiroki🐶, a data scientist.

State Space Representation of Transfer Functions

Now, as introduced in my previous blog, let’s discuss the single degree of freedom vibration model shown in the diagram below:

I would like to describe its transfer function in state space representation:

$$\begin{align*} G=\frac{x}{y}=\frac{cs+k}{ms^2+cs+k} \
\end{align*}$$

The basic form of the state space representation includes two equations (the state equation and the observation equation):

$$ \mathbf{\dot{x}} \begin{align*} &= \end{align*} A \mathbf{x} + B u        ・・・State equation
$$

$$ y \begin{align*} &= \end{align*} C \mathbf{x} + D u        ・・・Observation equation
$$

Where:

$$ \mathbf{x} \begin{align*} &= \end{align*} \begin{pmatrix} x \\
\dot{x} \\
\end{pmatrix}
$$

and u is the input.

This time,

  • I will introduce how to determine the state space representation A, B, C, D from the transfer function G.

First, we apply the Laplace transform to the state equation:

$$ \mathbf{\dot{x}} \begin{align*} &= \end{align*} A \mathbf{x} + B u $$

$$ s\mathbf{x} \begin{align*} &= \end{align*} A \mathbf{x} + B u $$

$$ s\mathbf{x} -A \mathbf{x} \begin{align*} &= \end{align*} B u $$

$$ (s\mathbf{I} -A) \mathbf{x} \begin{align*} &= \end{align*} B u $$

$$ \mathbf{x} \begin{align*} &= \end{align*} (s\mathbf{I} -A)^{-1} B u $$

Substituting this into the observation equation, we get:

$$ y \begin{align*} &= \end{align*} \lbrace \mathbf{C} (s\mathbf{I} -A)^{-1} B +D \rbrace u $$

Since u is the input and y is the output, the transfer function G is:

$$\begin{align*} G=\mathbf{C} (s\mathbf{I} -A)^{-1} B +D \
\end{align*}$$

To find A and B, you can use the following, as answered by ChatGPT in this article:

$$ A \begin{align*} &= \end{align*} \begin{pmatrix} 0 & 1 \\
-k/m & -c/m \\
\end{pmatrix}$$

$$ B \begin{align*} &= \end{align*} \begin{pmatrix} 0 \\
1/m \\
\end{pmatrix}$$

It is known that when the transfer function is proper (the numerator’s degree is lower than the denominator’s), D=0 What remains is to determine C Comparing the original mathematical model’s transfer function G with:

$$\begin{align*} G=\frac{x}{y}=\frac{cs+k}{ms^2+cs+k} \
\end{align*}$$

we determine C by comparing coefficients. Please try to do the calculations by hand with paper and pencil.

You will find that:

$$ C \begin{align*} &= \end{align*} \begin{pmatrix} c1 & c2 \\
\end{pmatrix}$$
and substitute the above A to D into the following G,  

$$\begin{align*} G=\mathbf{C} (s\mathbf{I} -A)^{-1} B +D \
\end{align*}$$

Comparing coefficients with the transfer function

$$\begin{align*} G=\frac{x}{y}=\frac{cs+k}{ms^2+cs+k} \
\end{align*}$$

Please try to do the calculations by hand with paper and pencil.

Then, you will find that

$$ C \begin{align*} &= \end{align*} \begin{pmatrix} k & c \\
\end{pmatrix}$$

Furthermore, in Matlab, there exists a convenient function “tf2ss” for finding the coefficients (A, B, C, D) of the state space representation from a transfer function.

It’s really handy. For detailed usage, please refer to this link.

If you wish to know more about the detailed formula transformations, ask ChatGPT, “What is the algorithm for Matlab’s tf2ss?” and you should receive a response.

That’s all for today. Thank you very much for reading until the end.

Love&Respect♡
Hiroki🐶