File Exchange

## Learning the Kalman-Bucy Filter in Simulink

version 1.0 (54.8 KB) by

A Simulink model to learn the continuous-time Kalman-Bucy Filter

Updated

This model simulates the continuous-time version of Kalman filter, i.e. Kalman-Bucy filter working with a continuous-time Gassian process. An m-file is developed to provide several examples to show how the Simulink model can be used.

The package is suitable for beginner to learn the Kalman-Bucy filter by just changing the model parameters without to know the details of calculations. By looking into masked subsystems, you will also be albe to learn how it can be implemented in Simulink.

The model is developed in MATLAB R14SP1 (MATLAB 7.0.1, Simulink 6.1). If there is a need to work with previous version, please let me know.

Jinya Su

### Jinya Su (view profile)

M Shivarama Shetty

andresfe24

### andresfe24 (view profile)

I just noticed that if I make the measurement matrix:

C = [1 0; 0 1]

the covariances behave appropriately. It is like if somehow the error from the velocity (which was not being measured) was accumulating on the estimates of the position and the velocity.

I am not sure why this is happening since the original measurement matrix:

C = [1 0];

produces an observable system (I verified this with the "obsv" and "rank" functions in Matlab).

Thanks.

andresfe24

### andresfe24 (view profile)

Very useful. Thanks!

For the ship position/velocity example, even though it seems like the filter successfully tracks the state, I saw that the covariances (P) are actualy growing. I am not sure why this would happen. I have tried modifying the model and measurement errors (Q and R), but still the covariances keep growing. What confuses me is that the error covariance for the position estimate starts actually decreasing, and then after several simulation steps, it starts to increase to much higher values.

Covariances seem to successfully decrease for the 4-state example, indicating more confidence on the estimates.

I tested this buy placing a Scope in the Simulink model to monitor the covariances.

Any comments on this are greatly appreciated.

V. Poor

### V. Poor (view profile)

Yuriy Pigovsky

It is very useful information for beginners.
Especially to those, who need to know that Kalman-Bucy filter is not just a kind of death theory, but a real think, which could be applied in real-world applications.

##### MATLAB Release
MATLAB 7.0.1 (R14SP1)
##### Acknowledgements

Inspired by: Learning the Kalman Filter in Simulink v2.1