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

Revision 974, 1.2 kB (checked in by smidl, 14 years ago)

Noise Particle

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
50
51M.class = 'NoiseParticle';
52M.g = g;
53M.h = h;
54M.yrv = y;
55M.rvx = x;
56M.rvxc = RVtimes(x,-1);
57M.rvyc = x;
58M.bm = A;
59
60PF.class='PF';
61PF.particle = M;
62PF.n = 1000;
63PF.res_threshold = 0.9;
64PF.prior.class = 'enorm<ldmat>';
65PF.prior.mu = [0.2;0.3];
66PF.prior.R = 0.1*eye(2);
67
68
69exper.ndat = 200;
70O = estimator(DS,{PF},exper);
71%%%%%% ARX estimator conditioned on frg
72
73% plot
74
75figure(1);
76hold off
77plot(O.Est0_apost_mean_R);
78
79figure(2)
80hold off
81plot(O.Est0_apost_mean_x);
82hold on
83plot(O.DS_dt_x,'--');
84
Note: See TracBrowser for help on using the browser.