Conversion of system functions and state equations

1. Introduction to the problem

I encountered such a problem before: given a sinusoidal signal and a system transfer function, use the system transfer function to perform Kalman filtering.

Using Kalman to filter requires first knowing the state equation of the system, so the question only gives the system transfer function, how can we get the state equation?

First look at the transfer function and equation of state.

Transfer Function:

H(s)=\frac{Y(s)}{X(s)}

Among them, H(s) is the system function, X(s) is the system input function, Y(s) is the system output function.

Equation of state:

\left\{\begin{matrix} \dot{x(t)}=Ax(t)+Bu(t)\\ y(t)=Cx(t)+Dv(t) \end{matrix}\right.

Where A is the state transition matrix, C is the observation matrix, and B and D are noise matrices.

2. Problem Solving

For example, the known system transfer function is

H(s)=\frac{s^2+2s+1}{s^3+2s^2+3s+1}

Find the coefficient matrix for the corresponding state equation.

2.1 Transfer function to state equation

The calling format of matlab for transferring function to state equation is: [A,B,C,D]=tf2ss(num,den).

The corresponding matlab code is as follows:

clc,clear
num=[1,2,1];
den=[1,2,3,1];
sys=tf(num,den)
[A,B,C,D]=tf2ss(num,den)

 The result is as follows:

The system function at this time is:

2.2 State equation to transfer function

The calling format of matlab from state equation to transfer function is: [num,den]=ss2tf(A,B,C,D).

The corresponding matlab code is as follows:

[b,a]=ss2tf(A,B,C,D)

The result is as follows:

The system function at this time is:

It can be seen that the converted system function is the same as the original system function.

After converting the system function into a state equation, Kalman filtering can be performed!

Guess you like

Origin blog.csdn.net/m0_64087341/article/details/132135042