quarc_extended_kalman_filter_demo.slx
Open this model

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

quarc_extended_kalman_filter_demo

QUARC Extended Kalman Filter Demo

This example demonstrates the use of non-linear state-space models and the extended Kalman filter as a non-linear model-based filter. The Nonlinear State Space block is used to simulate a pendulum with damping that is released at a 90 degree angle from vertical. The pendulum model produces a damped oscillation as a result.

Band-limited white noise is added to the pendulum angle to simulate a noisy measurement of the pendulum angle from a sensor. An Extended Kalman Filter block is then used to filter that noisy sensor measurement to produce an estimate of the actual pendulum angle. The Extended Kalman Filter is a non-linear filter based, in this case, on the non-linear state-space model of the pendulum. The actual angle and the filtered measurement are then compared to evaluate the effectiveness of the extended Kalman filter.

Extended Kalman Filter Demo Simulink Diagram

Demonstration

Building, deploying and starting the model

Refer to One Step Process in QUARC Basic Procedures to build, deploy and start the model.

Running the model

Double-click on the Scope block to open the Scope.

A plot of the pendulum oscillations will appear in the Measured Angle Scope. However, the signal will be noisy because white noise has been added to the simulated measurement.

Measured Angle

The output of the Kalman filter is compared to the actual pendulum position (without noise) in the Actual Angle versus Estimated Angle Scope. Notice how the filtered measurements closely track the actual pendulum position.

Comparison of Actual Angle to Filtered Angle

Stopping the model

Refer to One Step Process in QUARC Basic Procedures to stop the model.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.