主要内容

卡尔曼滤波器

预测或估计动态系统的状态

图书馆

Filtering/Adaptive Filters

dspadpt3

  • 卡尔曼过滤器块

描述

Use the Kalman Filter block to predict or estimate the state of a dynamic system from a series of incomplete and/or noisy measurements. Suppose you have a noisy linear system that is defined by the following equations:

x k = A x k 1 + w k 1 z k = H x k + v k

This block can use the previously estimated state, x ^ k 1 , to predict the current state at timek, x k ,如以下等式所示:

x k = A x ^ k 1 P k = A P ^ k 1 A T + Q

The block can also use the current measurement, z k , and the predicted state, x k ,估计时间的当前状态价值k, x ^ k ,使得它是一个更准确的近似值:

K k = P k H T ( H P k H T + R ) 1 x ^ k = x k + K k ( z k H x k ) P ^ k = ( I K k H ) P k

The variables in the previous equations are defined in the following table.

多变的 定义 默认值或初始条件
x State N/A
x ^ Estimated state zeros([6, 1])
x Predicted state N/A
A 状态过渡矩阵

[ 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ]

w Process noise N/A
z Measurement N/A
H Measurement matrix

[ 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ]

v Measurement noise N/A
P ^ 估计误差协方差 10*eye(6)
P- 预测错误协方差 N/A
Q Process noise covariance 0.05*eye(6)
K 卡尔曼获得了 N/A
R Measurement noise covariance 眼(4)
I 身份矩阵 N/A

在以前的方程式中z是测量值的向量。在大多数情况下,块过程z,一个m-n矩阵,其中m是测量值的数量,n是过滤器的数量。

Use the过滤器数parameter to specify the number of filters to use to predict or estimate the current value.

Use theEnable filtersparameter to specify which filters are enabled or disabled at each time step. If you select总是,始终启用过滤器。如果您选择Specify via input port ,Enable port appears on the block. The input to this port must be a row vector of 1s and 0s whose length is equal to the number of filters. For example, if there are 3 filters and the input to the Enable port is [1 0 1], only the first and third filter are enabled at this time step. If you select theReset the estimated state and estimated error covariance when filters are disabled复选框,估计和预测状态以及与残疾过滤器相对应的估计误差协方差重置为其初始值。

Note

All filters have the same state transition matrix, measurement matrix, initial conditions, and noise covariance, but their state, measurement, enable, and MSE signals are unique. Within the state, measurement, enable, and MSE signals, each column corresponds to a filter.

Use the测量矩阵源parameter to specify how to enter the measurement matrix values. If you selectSpecify via dialog,Measurement matrix参数出现在对话框中。如果您选择Input port ,H端口出现在块上。使用此端口指定您的测量矩阵。

Parameters

过滤器数

指定用于预测或估计当前值的过滤器数。

Enable filters

Specify which filters are enabled or disabled at each time step. If you select总是,始终启用过滤器。如果您选择Specify via input port ,Enable port appears on the block.

Reset the estimated state and estimated error covariance when filters are disabled

如果您选择this check box, the estimated and predicted states as well as the estimated error covariance that correspond to the disabled filters are reset to their initial values. This parameter is visible if, for theEnable filtersparameter, you selectSpecify via input port .

Initial condition for estimated state

输入估计状态的初始条件。

Initial condition for estimated error covariance

输入估计误差协方差的初始条件。

状态过渡矩阵

Enter the state transition matrix.

Process noise covariance

输入过程噪声协方差。

测量矩阵源

指定如何输入测量矩阵值。如果您选择Specify via dialog,Measurement matrix参数出现在对话框中。如果您选择Input port ,H端口出现在块上。

Measurement matrix

Enter the measurement matrix values. This parameter is visible if you selectSpecify via dialog为了测量矩阵源parameter.

Measurement noise covariance

输入测量噪声协方差。

Output estimated measurement

Select this check box if you want the block to output the estimated measurement.

输出估计状态

Select this check box if you want the block to output the estimated state.

估计状态的输出MSE

如果要该块输出估计状态的均方误差,请选择此复选框。

输出预测测量

如果要输出预测测量值,请选择此复选框。

输出预测状态

如果要输出预测状态,请选择此复选框。

Output MSE of predicted state

如果要该块输出预测状态的均方误差,请选择此复选框。

参考

[1] Haykin, Simon.Adaptive Filter Theory. Upper Saddle River, NJ: Prentice Hall, 1996.

[2] Welch,Greg和Gary Bishop,“ Kalman过滤器的简介”,TR 95-041,北卡罗来纳大学计算机科学系。

万博1manbetx支持的数据类型

Port Input/Output 万博1manbetx支持的数据类型

Z

m-n测量值,其中m是测量矢量的长度,n是过滤器的数量。

  • 双精度浮点

  • 单精度浮点

Enable

1-by-N vector of 1s and 0s where N is the number of filters.

  • 双精度浮点

  • 单精度浮点

  • Boolean

H

M-by-P测量矩阵where M is the length of the measurement vector and P is the length of the filter state vectors.

Same as Z port

Z_est

M-by-N estimated measurement matrix where M is the length of the measurement vector and N is the number of filters.

Same as Z port

X_est

P-by-N estimated state matrix where P is the length of the filter state vectors and N is the number of filters.

Same as Z port

MSE_est

1-by-N vector that represents the mean-squared-error of the estimated state. N is the number of filters.

Same as Z port

Z_prd

M-by-N predicted measurement matrix where M is the length of the measurement vector and N is the number of filters.

Same as Z port

x_prd

p-b-n预测状态矩阵,其中p是滤波器态向量的长度,n是过滤器的数量。

Same as Z port

MSE_prd

代表预测状态的均方纠正的1乘n向量。n是过滤器的数量。

Same as Z port

See Also

LDL Solver

DSP System Toolbox

Extended Capabilities

C/C ++代码生成
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2007a