this
Description
The Transition window contains an O-Matrix function that defines the Transition model for the study. The Transition window is an O-Matrix editor and as such you can perform standard editing commands within the window and using the Edit option from the O-Matrix menu bar. A specification of the Transition function follows:


tran(
kxkgkdgkQk)
The integer scalar k specifies the current time index. The double-precision column vector xk specifies an estimated State vector value, x , at time index k. The length of xk is the same as the length of the initial state estimate in the Data window .

The input value of gk does not matter. Its output value is equal to the Transition function g evaluated at the specified values for the State vector and time index; i.e.,
      g (x )
       k  k
It is as a double-precision column vector with length equal to the number of elements in xk.

The input value of dgk does not matter. Its output value is equal to the derivative of the Transition function g with respect the State vector; i.e.,
      d
      --  g (x )
      dx   k  k
        k
It is a square double-precision matrix with the same number of rows as xk.

The input value of Qk does not matter. Its output value is equal to the Transition variance Q at the specified time index; i.e.,
      Q
       k
. the variance of the noise in the transition. It is a double-precision positive definite matrix with the same number of rows as xk.

Example
The following is a picture of the Transition window for the example in EXAMPLE.KBF .



# Time interval
local Dt = 1.
This statements assigns the variable Dt to the time between data values. Because it begins with the word local, the variables Dt can be accessed anywhere within the Transition window and only within the Transition window. Because it appears outside the tran function, the statement is only executed once, instead of every time the function tran is called.

function tran(k, xk, gk, dgk, Qk) begin
This line begins the definition of the O-Matrix tran function and specifies the name its parameters will have inside of the function.

# derivative of transition function
dgk = double({ ...
      [1,  0, Dt,  0], ...
      [0,  1,  0, Dt], ...
      [0,  0,  1,  0], ...
      [0,  0,  0,  1] ...
})
This statement sets the dgk to a double-precision representation of the matrix
     / 1  0  Dt 0  \
     | 0  1  0  Dt |
     | 0  0  1  0  |
     \ 0  0  0  1  /
This matrix is equal to the derivative
      d
      --  g (x )
      dx   k  k
        k

# transition function value
gk = dgk * xk
This statement sets gk to the value of
      g (x )
       k  k
Note that the * is matrix multiplication operator and  
        g (1)  =  x (1)  +  Dt x (3)
         k         k            k
        g (2)  =  x (2)  +  Dt x (4)
         k         k            k
        g (3)  =  x (3)
         k         k
        g (4)  =  x (4)
         k         k

# variance of noise
Qk = diag({1d0, 1d0, 4d-1, 4d-1})
This statement sets Qk to a the double-precision diagonal matrix
     / 1  0  Dt 0  \
     | 0  1  0  Dt |
     | 0  0 .4  0  |
     \ 0  0  0 .4  /

end
This statement terminates the tran function definition.