%% Specify Nonadditive Measurement Noise in Extended Kalman Filter Object
% Create an extended Kalman filter object for a van der Pol oscillator with two states and one output. Assume that the process noise terms in the state transition function are additive. That is, there is a linear relation between the state and process noise. Also assume that the measurement noise terms are nonadditive. That is, there is a nonlinear relation between the measurement and measurement noise.

obj = extendedKalmanFilter('HasAdditiveMeasurementNoise',false);

%
% Specify the state transition function and measurement functions. Use the previously written and saved functions, vdpStateFcn.m and  vdpMeasurementNonAdditiveNoiseFcn.m.
% The state transition function is written assuming the process noise is additive. The measurement function is written assuming the measurement noise is nonadditive.

obj.StateTransitionFcn = @vdpStateFcn;
obj.MeasurementFcn = @vdpMeasurementNonAdditiveNoiseFcn;

%
% Specify the initial state values for the two states as [2;0].

obj.State = [2;0];

% You can now use the correct and predict commands to estimate the state and state estimation error covariance values from the constructed object.
% Copyright 2012 The MathWorks, Inc.