www.gusucode.com > control 案例程序 matlab源码代码 > control/CreateUKFObjectForOnlineStateEstimationExample.m

    %% Create Unscented Kalman Filter Object for Online State Estimation
%% 
% To define an unscented Kalman filter object for estimating the states of 
% your system, you write and save the state
% transition function and measurement function for the system.
%
% In this example, use the previously written and saved state transition and 
% measurement functions, |vdpStateFcn.m| and |vdpMeasurementFcn.m|. These
% functions describe a discrete-approximation to van der Pol oscillator with
% nonlinearity parameter, mu, equal to 1. The oscillator has two states.
%%
% Specify an initial guess for the two states. You specify the initial
% state guess as an
% |M|-element row or column vector, where |M| is the number of states.
initialStateGuess = [1;0];
%%
% Create the unscented Kalman filter object. Use function handles to provide
% the state transition and measurement functions to the object.
obj = unscentedKalmanFilter(@vdpStateFcn,@vdpMeasurementFcn,initialStateGuess);
%%
% The object has a default structure where the process and measurement 
% noise are additive.
%%
% To estimate the states and state estimation error covariance from the
% constructed object, use the |correct| and |predict| commands and real-time
% data.