# Mathematical basis of vehicle control theory — state equation

Time：2022-5-7

## 1. Use the equation of state to find the transfer function formula

The equation of state is$$G(s)=\dfrac{Y(s)}{U(s)} = C(sI-A)^{-1}B+D$$

Example 1:$$m-c-k$$System, seeking$$m\overset{··}{x}+c\overset{·}{x}+kx=f$$Transfer function.
Solution:
order$$x_1 = x$$$$x_2=\overset{·}{x}$$Then there are:

$\begin{cases} \overset{·}{x_1}=x_2\\ \overset{·}{x_2}=\dfrac{1}{m}[-c x_2-k x_1]+\dfrac{f}{m} \end{cases}$

According to the vector expression of the state equation and the vector expression of the output equation

$\begin{cases} \overset{·}{X} = AX+Bf \\ Y = CX+Df \end{cases}$

You can get:

$A=\left[\begin{matrix} 0 & 1\\ -\dfrac{k}{m}& -\dfrac{c}{m} \end{matrix}\right]\qquad B = \left[\begin{matrix} 0\\ \dfrac{1}{m} \end{matrix}\right]\qquad C=\left[ \begin{matrix}1&0\end{matrix}\right]\qquad D = 0 \qquad X = \left[\begin{matrix}x_1\\x_2\end{matrix}\right]$

therefore

$(sI-A)^{-1} = \left[\begin{matrix} s&-1\\ \dfrac{k}{m}&s+\dfrac{c}{m} \end{matrix}\right]^{-1}=\dfrac{1}{\left|\begin{matrix} s&-1\\ \dfrac{k}{m}&s+\dfrac{c}{m} \end{matrix}\right|}\left[\begin{matrix} s+\dfrac{c}{m}&1\\ -\dfrac{k}{m}&s \end{matrix}\right]$

Can get

$G(s)=\dfrac{1}{s^2+\dfrac{c}{m}s+\dfrac{k}{m}}\left[\begin{matrix}1&0\end{matrix}\right]\left[\begin{matrix} s+\dfrac{c}{m}&1\\ -\dfrac{k}{m}&s \end{matrix}\right] \left[\begin{matrix} 0\\ \dfrac{1}{m} \end{matrix}\right]=\dfrac{1}{ms^2+cs+k}$

## 2. Feedback control

### 2.1 design of state feedback controller

The control law is$$u = -KX + v$$
The closed-loop system can be obtained by bringing the control law into the state equation$$\begin{cases} \overset{·}{X}=(A-BK)X+Bv\\ Y = CX \end{cases}$$

The transfer function is$$G_K(s)=C(sI-A+BK)^{-1}B$$

Example 2:$$\overset{··}{x}=\overset{·}{x}+x+u$$, how to design$$u$$, make$$x \rarr x_d\quad(t\rarr\infty)$$$$x_d$$Is a constant.

Solution:
Input yes$$u$$, the characteristic equation is$$s^2-s-1=0$$

It can be seen that the system is open-loop unstable, because there is a root in the right half plane, which can be designed$$u=-2\overset{·}{x}-2x+x_d$$

Substituting into the above system, we can get$$\overset{··}{x}+\overset{·}{x}+x=x_d$$

For the closed-loop system at this time, the input is$$x_d$$, the characteristic equation is$$s^2+s+1=0$$, the two equations are negative and the closed-loop is stable.

If the method of equation of state is used, then you can make$$x_1 = x$$$$x_2=\overset{·}{x}$$, you can get

$\begin{cases} \overset{·}{x_1}=x_2\\ \overset{·}{x_2}=x_1+x_2+u \end{cases}$

Then you can get:

$A=\left[\begin{matrix} 0 & 1\\ 1&1 \end{matrix}\right]\qquad B = \left[\begin{matrix} 0\\ 1 \end{matrix}\right]\qquad C=\left[ \begin{matrix}1&0\end{matrix}\right]\qquad D = 0 \qquad X = \left[\begin{matrix}x_1\\x_2\end{matrix}\right]$

The control law is$$u = -KX + x_d$$, where$$K=[k_1, k_2]$$, then

\begin{aligned} (sI-A+BK)^{-1} &= \left( \left[ \begin{matrix} s&0\\ 0&s \end{matrix}\right]-\left[\begin{matrix} 0 & 1\\ 1&1 \end{matrix}\right]+\left[\begin{matrix} 0\\ 1 \end{matrix}\right][k_1, k_2]\right)^{-1}\\ &=\left[ \begin{matrix} s&-1\\ -1+k_1&s-1+k_2 \end{matrix}\right]^{-1}\\ &=\dfrac{1}{s^2+(k_2-1)s+k_1-1}\left[\begin{matrix} s-1+k_2&1\\ 1-k_1&s \end{matrix}\right] \end{aligned}

The transfer function is

\begin{aligned} G_k(s)&=C(sI-A+BK)^{-1}B\\ &=\dfrac{1}{s^2+(k_2-1)s+k_1-1}\left[ \begin{matrix}1&0\end{matrix}\right]\left[\begin{matrix} s-1+k_2&1\\ 1-k_1&s \end{matrix}\right]\left[\begin{matrix} 0\\ 1 \end{matrix}\right]\\ &=\dfrac{1}{s^2+(k_2-1)s+k_1-1} \end{aligned}

If order$$k_1=k_2=2$$, then the characteristic equation is$$s^2+s+1=0$$, same as the above.

The following figure shows the structure of the state feedback system

### 2.2 design of output feedback controller

The control law is$$u = -HY + v$$
The closed-loop system can be obtained by bringing the control law into the state equation$$\begin{cases} \overset{·}{X}=(A-BHC)X+Bv\\ Y = CX \end{cases}$$

The transfer function is$$G_H(s)=C(sI-A+BHC)^{-1}B$$

Output feedback can be regarded as a special case of state feedback. For example, when y = x, C = 1.

The following is the structure diagram of output feedback system

The controller is the design principle of PID controller.

## 3. Feedback linearization

Example 3:$$\overset{··}{x}=\overset{·}{x}\ ^2+x+u$$, how to design$$u$$, make$$x\rarr x_d\quad(t\rarr \infty)$$, where$$x_d$$Is a constant.

Design$$u=-\overset{·}{x}\ ^2-x+v$$

Substitution system$$\overset{··}{x}=\overset{·}{x}\ ^2+x+u$$

sureRemove nonlinear term, get$$\overset{··}{x}=v$$

The above equation has been linearized, butOpen loop instability。 utilizefeedback controlMethod, design:$$v=-\overset{·}{x}-x+x_d$$

obtainClosed loop stabilitySystem:$$\overset{··}{x}+\overset{·}{x}+x=x_d$$

We can write the tracking error equation of the closed-loop system. order$$\epsilon=x-x_d$$, the system can be converted to

$\overset{··}{\epsilon}+\overset{·}{\epsilon}+\epsilon=0$

The equation has two complex roots and can be described as$$s_{1,2}=\alpha\plusmn\beta i$$In which$$\alpha<0$$

The solution can be expressed as:$$\epsilon_{1,2}=e^{\alpha t}(c_1cos\beta t\plusmn c_2isin\beta t)$$

It can be concluded that$$\epsilon_{1,2}\rarr0$$, indicating that the system is stable.

Summary of feedback linearization methods:Input state linearizationandInput-output linearization

• For the former, in this example, you can make$$z=z(x)=\overset{·}{x}\quad \overset{··}{x}=v$$, you can get the solution$$u=u(x, v)=-\overset{·}{x}\ ^2-x+v$$, the linear system at this time is$$\overset{··}{x}=v$$
• For the latter, in this example, you can make$$y=h(x)=x$$, therefore$$\overset{··}{y}=g(x,u)=\overset{··}{x}=\overset{·}{x}\ ^2+x+u$$So you get the output$$y$$And input$$u$$Relationship, order$$\overset{··}{y}=v$$, also get$$u=-\overset{·}{x}\ ^2-x+v$$

It can be seen that the solution process of the two methods in this example is consistent.

## Python panel time series data prediction: Granger causality test, Granger causality test, drug sales example and visualization

Original link:http://tecdat.cn/?p=23940 Time series is based on fixed time_ Interval_ Recorded observation sequence. This guide takes you through the process of analyzing the characteristics of a given time series in Python. content What is time series? How do I import time series in Python? What is panel data? Visualization of time series Patterns in time […]