EKF - Linear System Model
This document describes the use of the Extended Kalman Filter (EKF) in the REXYGEN environment for state estimation of a linear system.
System Description
The system is described by the following differential equations:
\begin{aligned}
\frac{dx(t)}{dt} &= f(x(t), u(t)) + w(t),\\
y(t) &= h(x(t), u(t)) + v(t),\\
\hat{x}(t) &\sim \mathcal{N}(x, P),\\
w(t) &\sim \mathcal{N}(0, Q),\\
v(t) &\sim \mathcal{N}(0, R).
\end{aligned}
where:
- $ x(t) $ is the state vector,
- $ u(t) $ is the input vector,
- $ y(t) $ is the output vector,
- $ w(t) $ is the process noise,
- $ v(t) $ is the measurement noise,
- $ \hat{x}(t) $ is the estimated state vector,
- $ x $ is the mean (expected value),
- $ P $ is the state estimation covariance matrix,
- $ Q $ is the process noise covariance matrix,
- $ R $ is the measurement noise covariance matrix.
State Model of the System
The system dynamics are defined by the function $ f(x(t), u(t)) $:
f(x(t), u(t)) =
\begin{bmatrix}
\frac{dx_1(t)}{dt} \\
\frac{dx_2(t)}{dt} \\
\frac{dx_3(t)}{dt} \\
\frac{dx_4(t)}{dt}
\end{bmatrix}
=
\begin{bmatrix}
-x_1(t) + x_2(t) \\
-x_2(t) + x_3(t) \\
-x_3(t) + x_4(t) \\
-x_4(t) + u_1(t)
\end{bmatrix}.
Jacobian of the State Function
The Jacobian $ f(x, u) $ with respect to the state vector $ x $ is given as:
\frac{df(x(t), u(t))}{dx} =
\begin{bmatrix}
-1 & 1 & 0 & 0 \\
0 & -1 & 1 & 0 \\
0 & 0 & -1 & 1 \\
0 & 0 & 0 & -1
\end{bmatrix}
Output Measurements
The first set of output measurements (which, in this example, depend linearly on the state variables) for input EKF:nz = 1 is defined as:
y(t) = h_1(x(t), u(t)) =
\begin{bmatrix}
x_1(t) \\
2 x_2(t) + 0.5 x_4(t)
\end{bmatrix},
with the corresponding Jacobian:
\frac{dh_1(x(t), u(t))}{dt} =
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 2 & 0 & 0.5 \\
\end{bmatrix}.
The second set of output measurements (for input EKF:nz = 2) is not used.
The system description is programmed into the REXLANG block.
This description serves as a basis for implementing the EKF in REXYGEN using the EKF function block. Further details can be found in the official documentation: EKF Block in REXYGEN.