root/applications/bdmtoolbox/sandbox/mpf_arx_3.m @ 1141

Revision 981, 1.3 kB (checked in by smidl, 14 years ago)

arx mpf experiment

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