blob: 606e03ba5efb179d23e6a9d1ed69361a68dd658e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Kalman filter example of estimating a constant, discussed in Example 14.7.
// 14.3
exec('kal_ex.sci',-1);
x = 5; xhat = 2; P = 1; xvec = x;
xhat_vec = xhat; Pvec = P; yvec = x;
for i = 1:200,
xline = xhat; M = P;
[xhat,P,y] = kal_ex(x,xline,M);
xvec = [xvec;x];
xhat_vec = [xhat_vec;xhat];
Pvec = [Pvec;P]; yvec = [yvec;y];
end
n = 1:201;
plot(Pvec);
xtitle('','n');
halt();
clf();
plot(n,xhat_vec',n,yvec',n,xvec');
xtitle('','n');
|