Index-> contents reference index search external Previous Next Up-> ckbs ckbs_nonlinear vanderpol_ok.m vanderpol_g.m ckbs-> license ckbs_t_general ckbs_nonlinear ckbs_L1_nonlinear ckbs_affine ckbs_affine_singular ckbs_L1_affine utility all_ok.m whatsnew wishlist bib ckbs_nonlinear-> get_started_ok.m sine_wave_ok.m vanderpol_ok.m nonlinear_utility vanderpol_ok.m-> vanderpol_sim vanderpol_g.m vanderpol_g.m Headings-> Syntax Notation Purpose initial dt mu k xk1 gk Gk Source Code

ckbs_nonlinear: Vanderpol Transition Model Mean Example
.

Syntax
[gk]     = vanderpol_g(k, xk1, params)  [gk, Gk] = vanderpol_g(k, xk1, params) 
Notation
       initial  = params.vanderpol_g_info.initial       dt       = params.vanderpol_g_info.dt       mu       = params.vanderpol_g_info.mu 
Purpose
Computes gk as the mean of the state at time index k given xk1 is its value at time index k-1 . This mean is Euler's discrete approximation for the solution of the Van Der Pol oscillator ODE; i.e.,   $\begin{array}{rcl} x_1 '(t) & = & x_2 (t) \\ x_2 '(t) & = & \mu [ 1 - x_1(t)^2 ] x_2 (t) - x_1(t) \end{array}$  where the initial state is xk1 and the time step is dt .

initial
is a column vector of length two specifying the initial estimate for the state vector at time index one.

dt
is a scalar specifying the time between points for this Kalman smoother (also referred to as   \Delta t below).

mu
is a scalar specifying the value of   \mu in the Van Der Pol ODE.

k
is a positive integer scalar specifying the current time index (not used).

xk1
is a column vector with two elements specifying a value for the state vector at the previous time index k-1 .

gk
If k == 1 , the return value gk is two element column vector equal to initial . Otherwise, gk is the two element column vector given by   $\begin{array}{rcl} g_{1,k} & = & x_{1,k-1} + x_{2,k-1} \Delta t \\ g_{2,k} & = & x_{2,k-1} + [ \mu ( 1 - x_{1,k-1}^2 ) x_{2,k-1} - x_{1,k-1} ] \Delta t \end{array}$  where   ( g_{1,k} , g_{2,k} )^\R{T} is gk and   ( x_{1,k-1} , x_{2,k-1} )^\R{T} is xk1 .

Gk
The return value Gk is an n x n matrix equal to the Jacobian of gk w.r.t xk1 .

Source Code  function [gk, Gk] = vanderpol_g(k, xk1, params) initial = params.vanderpol_g_initial; dt = params.vanderpol_g_dt; mu = params.vanderpol_g_mu; n = 2; if (size(xk1,1) ~= n) | (size(xk1,2) ~= 1) size_xk1_1 = size(xk1, 1) size_xk1_2 = size(xk1, 2) error('vanderpol_g: xk1 not a column vector with two elements') end if (size(initial,1) ~= n) | (size(initial,2) ~= 1) size_initial_1 = size(initial, 1) size_initial_2 = size(initial, 2) error('vanderpol_g: initial not a column vector with two elements') end if (size(dt,1)*size(dt,2) ~= 1) | (size(mu,1)*size(mu,2) ~= 1) size_dt_1 = size(dt, 1) size_dt_2 = size(dt, 2) size_mu_1 = size(mu, 1) size_mu_2 = size(mu, 2) error('vanderpol_g: dt or mu is not a scalar') end if k == 1 gk = initial; Gk = zeros(n, n); else gk = zeros(n, 1); gk(1) = xk1(1) + xk1(2) * dt; gk(2) = xk1(2) + (mu * (1 - xk1(1)*xk1(1)) * xk1(2) - xk1(1)) * dt; % Gk = zeros(n, n); Gk(1,1) = 1; Gk(1,2) = dt; Gk(2,1) = (mu * (- 2 * xk1(1)) * xk1(2) - 1) * dt; Gk(2,2) = 1 + mu * (1 - xk1(1)*xk1(1)) * dt; end return end 
Input File: example/nonlinear/vanderpol_g.m