Index-> contents reference index search external Previous Next Up-> ckbs ckbs_nonlinear nonlinear_utility direct_h.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 nonlinear_utility-> box_f.m direct_h.m distance_h.m no_f.m persist_g.m pos_vel_g.m sine_f.m direct_h.m Headings-> Syntax Notation Purpose k xk index hk Hk Source Code

ckbs_nonlinear: Example Direct Measurement Model

Syntax
[hk    = direct_h(kxkparams)
[hkHk] = direct_h(kxkparams)

Notation

index     = params.direct_h_index

m         = size(index, 1)

n         = size(xk, 1)

Purpose
For i = 1 , ... , m , the mean of the i-th measurement given xk (the state at time index k ) is

xkindex(i) )

k
is an integer scalar specifying the time index (not used).

xk
is a column vector with length n specifying a value for the state vector at the current time index.

index
is an integer column vector that specifies which components of xk correspond to the direct measurements. Each element of index must be between one and n .

hk
The return value hk is a column vector of length m with i-th element equal to the mean of the i-th measurement given xk .

Hk
The return value Hk is a m x n matrix equal to the Jacobian of hk w.r.t xk .

Source Code

function [hk, Hk] = direct_h(k, xk, params)
index = params.direct_h_index;
m        = size(index, 1);
n        = size(xk, 1);
if (size(xk, 2)~=1) | (size(index,2)~=1)
size_xk_2    = size(xk, 2)
size_index_2 = size(index, 2)
error('direct_h: xk or index is not a column vector')
end
if (max(index) > n) | (min(index) < 1)
max_index = max(index)
min_index = min(index)
error('direct_h: max(index) > size(xk, 1) or min(index) < 1')
end
hk  = xk(index);
Hk  = zeros(m, n);
for i = 1 : m
Hk( i, index(i) ) = 1;
end
return
end

Input File: example/nonlinear/direct_h.m