observation update
[x1,y]=system(x0,f,g,h,q,r)
input state vector
system matrix
input matrix
Output matrix
input noise covariance matrix
output noise covariance matrix
output state vector
output observation
define system function which generates the next observation given the old state. System recursively calculated
where u
is distributed N(0,q)
and v
is distribute N(0,r)
.
// initialize state statistics // (mean and err. variance) m0=[10 10]'; p0=[2 0;0 2]; // create system f=[1.1 0.1;0 0.8]; g=[1 0;0 1]; h=[1 0;0 1]; // noise statistics q=[.03 0.01;.01 0.03]; r=2*eye(2); // initialize system process rand("seed",2); rand("normal"); p0c=chol(p0); x0=m0+p0c'*rand(ones(m0)); yt=[]; //initialize kalman filter xke0=m0;pk0=p0; // initialize err. variance ecv=[pk0(1,1) pk0(2,2)]'; [x1,y]=system(x0,f,g,h,q,r) | ![]() | ![]() |