kalman (MathScript RT Module Function)
- Updated2023-03-14
- 2 minute(s) read
kalman (MathScript RT Module Function)
Owning Class: ssdesign
Requires: Control Design and Simulation Module and MathScript RT Module
Syntax
[SysKal, L, P, M, Z] = kalman(SysInSS, Q, R)
[SysKal, L, P, M, Z] = kalman(SysInSS, Q, R, N)
Description
Calculates the optimal steady-state Kalman gain L that minimizes the covariance of the state estimation error. You can use this function to calculate L for continuous and discrete system models.
Inputs
| Name | Description |
|---|---|
| SysInSS | Specifies a linear time-invariant (LTI) model in state-space form. |
| Q | Specifies the auto-covariance matrix of the process noise, if the SysInSS model is discrete. If the model is continuous, Q specifies the auto-intensity matrix of the process noise. Q is a real matrix that is symmetric and positive semi-definite. |
| R | Specifies the auto-covariance matrix of the measurement noise, if the SysInSS model is discrete. If the model is continuous, R specifies the auto-intensity matrix of the process noise. R is a real matrix that is symmetric and positive definite. |
| N | Specifies the cross-covariance matrix between the process noise and the measurement noise, if the SysInSS model is discrete. If the model is continuous, N specifies the cross-intensity matrix between the process noise and the measurement noise. The default is an appropriately sized matrix of zeros, which specifies the process noise and measurement noise are uncorrelated. N must be valid such that (Q - N*inv(R)*N') is positive semi-definite. N is a real matrix. |
Outputs
| Name | Description |
|---|---|
| SysKal | Returns the definition of the Kalman filter with the gain matrix L applied. SysKal is an LTI model in state-space form. |
| L | Returns the gain matrix that minimizes the covariance of the state estimation error. L is a real matrix. |
| P | Returns the steady-state covariance of the estimation error. P is a real matrix. |
| M | 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. M is a real matrix. |
| Z | Returns the steady-state error covariance of the error between the actual states and the updated state estimates in the discrete estimation process. Z is a real matrix. |
Details
The following table lists the support characteristics of this function.
| Supported in the LabVIEW Run-Time Engine | Yes |
| Supported on RT targets | Yes |
| Suitable for bounded execution times on RT | Not characterized |
Examples
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];
SysInSS = ss(A, [B G], C, [D H]);
[SysKal, L, P] = kalman(SysInSS, Q, R, N)