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

Revision 811, 1.1 kB (checked in by smidl, 14 years ago)

extensions and stuff for MPF

Line 
1x = RV('x',2);
2y = RV('y',2);
3
4g.class = 'mexFnc';
5g.dim = 2;
6g.dimc = 2;
7g.function = 'test_function';
8
9h.class = 'linfn';
10h.A     = eye(2);
11h.B     = [1;0];
12
13fx.class = 'mgnorm<chmat>';
14fx.R = [0.3 -0.2; -0.2 0.5];
15fx.g = g;
16fx.rv = x;
17fx.rvc = RVtimes(x,-1);
18
19fy.class = 'mgnorm<chmat>';
20fy.R = 0.1*eye(2);
21fy.g = h;
22fy.rv = y;
23fy.rvc = x;
24
25
26%%%%%% Data generator
27DS.class   = 'PdfDS';
28DS.pdf.class     = 'mprod';
29DS.pdf.pdfs      = {fy,fx};
30DS.init_rv = RVtimes(x,-1);
31DS.init_values = [.2,.3]';
32
33%%%%% Estimator
34A.class = 'ARX';
35A.rv = y;
36A.rgr = RV({});
37A.rv_param = RV('R',4);
38A.dimx=2;
39A.constant = 0;
40A.frg=0.99;
41
42A2=A;
43A2.rv_param = RV('Q',4);
44A2.rv=x;
45
46E.class = 'MPF_ARXg';
47E.g = g;
48E.h = h;
49E.rvc = x;
50E.arxo = A;
51E.arxp = A2;
52E.prior.class = 'enorm<ldmat>';
53E.prior.mu = [0.2;0.3];
54E.prior.R = 0.1*eye(2);
55E.n = 100;
56E.res_threshold = 1.0;
57
58
59exper.ndat = 2000;
60M = estimator(DS,{E},exper);
61%%%%%% ARX estimator conditioned on frg
62
63% plot
64
65figure(1);
66hold off
67plot(M.Est0_Q_Q);
68hold on
69plot(ones(size(M.Est0_Q_Q,1),1)* DS.pdf.pdfs{2}.R(:)','--');
70
71figure(2)
72hold off
73plot(M.Est0_apost_mean_);
74hold on
75plot(M.DS_x,'--');
76
Note: See TracBrowser for help on using the browser.