www.gusucode.com > control 案例程序 matlab源码代码 > control/CreateExtendedKalmanFilterObjectForOnlineStateEstimationExample.m
%% Create Extended Kalman Filter Object for Online State Estimation %% % To define an extended Kalman filter object for estimating the states of % your system, you first 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 a 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 guess as an % |M|-element row or column vector, where |M| is the number of states. initialStateGuess = [1;0]; %% % Create the extended Kalman filter object. Use function handles to provide % the state transition and measurement functions to the object. obj = extendedKalmanFilter(@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.