kalman

Kalman filter or estimator.

Syntax

[kest, L, P, M, Z] = kalman(SYS, QN, RN, NN)

[KEST, L, P, M, Z] = kalman(SYS, QN, RN, NN, SENSORS, KNOWN)

Inputs

SYS
Nominal plant space-state model.
QN
Covariance of white process noise.
RN
Covariance of white measurement noise.
NN
Cross-covariance matrix between the process noise and the measurement noise.
SENSORS
Indices of measured output signals.
KNOWN
Indices of known input signals.

Outputs

KEST
A state-space LTI form. Returns the definition of the Kalman filter with the gain matrix L applied.
L
A real matrix. Returns the gain matrix that minimizes the covariance of the state estimation error.
P
A real matrix. Returns the steady-state covariance of the estimation error.
M
A real matrix. Returns the steady-state innovation gain matrix. This gain matrix weights the difference between the observed and estimated outputs in the updated state estimates for discrete estimators.
Z
A real matrix. Returns the steady-state error covariance of the error between the actual states and the updated state estimates in the discrete estimation process.

Examples

Kalamn filter design:
A = [-1 0.1; 0 -2];
B = [0; 1];
G = [1 0; 0 1];
C = [1 0];
D = [0];
H = [0 0];
Q = [0.1 0; 0 0.1];
R = [1];
N = [0; 0];
sys1 = ss(A, [B G], C, [D H]);
[kest1, l1, p1, m1, z1] = kalman(sys1, Q, R, N)
kest1 = object [
Scaled: 0
TimeUnit: seconds
ts: 0
a: [Matrix] 2 x 2
-1.04889   0.10000
-0.00082  -2.00000
b: [Matrix] 2 x 2
0.00000  0.04889
1.00000  0.00082
c: [Matrix] 3 x 2
1  0
1  0
0  1
d: [Matrix] 3 x 2
0  0
0  0
0  0
e: [Matrix] 2 x 2
1  0
0  1
type: StateSpaceModel
]
l1 = [Matrix] 2 x 1
0.04889
0.00082
p1 = [Matrix] 2 x 2
0.04889  0.00082
0.00082  0.02500
m1 = [Matrix] 0 x 0
z1 = [Matrix] 0 x 0
Kalamn filter design from state-space matrices:
sys2 = ss (-2, 1, 1, 3);
[kest2, l2, p2, m2, z2] = kalman (sys2, 1, 1, 1)
kest2 = object [
Scaled: 0
TimeUnit: seconds
ts: 0
a: -2.25
b: 0.25
c: [Matrix] 2 x 1
1
1
d: [Matrix] 2 x 1
0
0
e: 1
type: StateSpaceModel
]
l2 = 0.25
p2 = 0
m2 = [Matrix] 0 x 0
z2 = [Matrix] 0 x 0

Comments

kalman designs a Kalman filter or Kalman state estimator.

References:
  • Franklin, G.F., J.D. Powell, and M.L. Workman, Digital Control of Dynamic Systems, Addison-Wesley, 1990
  • Lewis, F., Optimal Estimation, John Wiley and Sons, Inc, 1986