lqe

Linear quadratic estimator (Kalman Filter)

Syntax

[L, P, E] = lqe(A, G, C, Q, R)

[L, P, E] = lqe(A, G, C, Q, R, N)

Inputs

A
The state matrix (n x n), where n is the number of states.
G
Specifies a matrix that relates the process noise to the states.
C
The output matrix (q x n), where q is the number of outputs.
Q
The state weighting matrix (n x n), which is symmetric, positive semi-definite.
R
The input weighting matrix (p x p), which is symmetric, positive definite.
N
The state/input cross product weighting matrix, such that Q - N*inv(R)*N' is positive semi-definite.

Outputs

L
The Kalman gain matrix.
P
The solution of the Discrete Algebraic Riccati Equation.
E
The closed-loop pole locations, which are the eigenvalues of the matrix A-LC.

Example

Mass-spring-damper system design:
c = 1;
m = 1;   %Mass in kg
k = 1;   %Spring Constant
A = [0 1; -k/m -c/m];
B = [0; 1/m];
G = [1 0 ; 0 1];
C = [1 0];
Q = [0.01 0; 0 0.01];
R = [0.01];
[l, p, e] = lqe(A, G, C, Q, R)
l = [Matrix] 2 x 1
 0.86121
-0.12916
p = [Matrix] 2 x 2
 0.00861  -0.00129
-0.00129   0.00621
e = [Matrix] 2 x 1
-0.93060 + 0.93060i
-0.93060 - 0.93060i

Comments

The function calculates the optimal steady-state feedback gain matrix L that minimizes a quadratic cost function for a linear discrete state-space system model.