Revision 981, 1.3 kB
(checked in by smidl, 14 years ago)
|
arx mpf experiment
|
Line | |
---|
1 | clear all; |
---|
2 | x = RV('x',2); |
---|
3 | y = RV('y',2); |
---|
4 | |
---|
5 | g.class = 'mexFnc'; |
---|
6 | g.dim = 2; |
---|
7 | g.dimc = 2; |
---|
8 | g.function = 'test_function'; |
---|
9 | |
---|
10 | % g.class = 'linfn'; |
---|
11 | % g.A = eye(2); |
---|
12 | % g.B = [1;0]; |
---|
13 | |
---|
14 | h.class = 'linfn'; |
---|
15 | h.A = eye(2); |
---|
16 | h.B = [1;0]; |
---|
17 | |
---|
18 | fx.class = 'mgnorm<chmat>'; |
---|
19 | fx.R = [0.03 -0.02; -0.02 0.05]; |
---|
20 | fx.g = g; |
---|
21 | fx.rv = x; |
---|
22 | fx.rvc = RVtimes(x,-1); |
---|
23 | |
---|
24 | fy.class = 'mgnorm<chmat>'; |
---|
25 | fy.R = 0.01*eye(2); |
---|
26 | fy.g = h; |
---|
27 | fy.rv = y; |
---|
28 | fy.rvc = x; |
---|
29 | |
---|
30 | |
---|
31 | %%%%%% Data generator |
---|
32 | DS.class = 'PdfDS'; |
---|
33 | DS.pdf.class = 'mprod'; |
---|
34 | DS.pdf.pdfs = {fy,fx}; |
---|
35 | DS.init_rv = RVtimes(x,-1); |
---|
36 | DS.init_values = [.2,.3]'; |
---|
37 | |
---|
38 | %%%%% Estimator |
---|
39 | A.class = 'ARX'; |
---|
40 | A.yrv = RV('vw',4); |
---|
41 | A.rv = RV('R',16); |
---|
42 | A.rgr = RV({}); |
---|
43 | A.dimx=4; |
---|
44 | A.constant = 0; |
---|
45 | A.frg=1.0; |
---|
46 | A.prior.class='egiw'; |
---|
47 | A.prior.dimx=4; |
---|
48 | A.prior.V =1e-3*eye(4); |
---|
49 | %A.prior.nu = 10; |
---|
50 | |
---|
51 | |
---|
52 | M.class = 'NoiseParticle'; |
---|
53 | M.g = g; |
---|
54 | M.h = h; |
---|
55 | M.yrv = y; |
---|
56 | M.rvx = x; |
---|
57 | M.rvxc = RVtimes(x,-1); |
---|
58 | M.rvyc = x; |
---|
59 | M.bm = A; |
---|
60 | |
---|
61 | PF.class='PF'; |
---|
62 | PF.particle = M; |
---|
63 | PF.n = 100; |
---|
64 | PF.res_threshold = 0.9; |
---|
65 | PF.prior.class = 'enorm<ldmat>'; |
---|
66 | PF.prior.mu = [0.2;0.3]; |
---|
67 | PF.prior.R = 0.1*eye(2); |
---|
68 | |
---|
69 | |
---|
70 | exper.ndat = 200; |
---|
71 | O = estimator(DS,{PF},exper); |
---|
72 | %%%%%% ARX estimator conditioned on frg |
---|
73 | |
---|
74 | % plot |
---|
75 | |
---|
76 | figure(1); |
---|
77 | hold off |
---|
78 | plot(O.Est0_apost_mean_R); |
---|
79 | |
---|
80 | figure(2) |
---|
81 | hold off |
---|
82 | plot(O.Est0_apost_mean_x); |
---|
83 | hold on |
---|
84 | plot(O.DS_dt_x,'--'); |
---|
85 | |
---|