root/applications/bdmtoolbox/sandbox/mpf_arx.m @ 1126

Revision 871, 1.8 kB (checked in by mido, 15 years ago)

adaptation of /applications to new version of LOG_LEVEL
also, a cosmetic change made in enumerations: logub -> logubound, loglb -> loglbound

Line 
1x = RV('x',2);
2fx.class = 'mlnorm<ldmat>';
3fx.A = [1 -0.9; 1 -0.3];
4fx.const = [0;0];
5fx.R = [0.1 0.05; 0.05 0.1];
6fx.rv = x;
7fx.rvc = RVtimes(x,-1);
8
9y = RV('y',2);
10fy.class = 'mlnorm<ldmat>';
11fy.A = [1 0.5; -0.3 0];
12fy.const = [0;0];
13fy.R = 0.1*eye(2);
14fy.rv = y;
15fy.rvc = x;
16
17
18%%%%%% Data generator
19DS.class   = 'PdfDS';
20DS.pdf.class  = 'mprod';
21DS.pdf.pdfs   = {fy,fx};
22
23Dt = simulator(DS);
24%%%%%% ARX estimator conditioned on frg
25
26A1.class = 'ARX';
27A1.rv = y;
28A1.rgr = x ;
29A1.constant = 0;
30A1.log_level ='logbounds,logevidence';
31A1.frg = 0.98;
32A1.name = 'A1';
33
34%%%%%% Combining estimators in Marginalized particle filter
35E.class = 'MPF';
36E.BM = A1;                         % ARX is the analytical part
37E.parameter_pdf = fx;              % Random walk is the parameter evolution model
38E.res_threshold = 1.0;             % resampling parameter
39E.n = 1000;                         % number of particles
40E.prior.class = 'enorm<ldmat>';    % prior on non-linear part
41E.prior.mu    = [0 0];             %
42E.prior.R     = 10*eye(2);         %
43E.log_level ='logbounds,logevidence';
44E.name = 'MPF';
45
46exp.ndat = 1000;
47
48M=estimator(DS,{E},exp);
49
50%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51% plot results
52ndat = size(M.DS_x,1);
53
54
55figure(1);
56subplot(4,1,1);
57plotestimates(fy.A(1,1)*ones(ndat,1), M.MPF_apost_mean_theta(:,1), M.MPF_apost_lb_theta(:,1), M.MPF_apost_ub_theta(:,1));
58title(' Parameters C(1,1)')
59subplot(4,1,2);
60plotestimates(fy.A(1,2)*ones(ndat,1), M.MPF_apost_mean_theta(:,2), M.MPF_apost_lb_theta(:,2), M.MPF_apost_ub_theta(:,2));
61title(' Parameters C(1,2)')
62subplot(4,1,3);
63plotestimates(fy.A(2,1)*ones(ndat,1), M.MPF_apost_mean_theta(:,3), M.MPF_apost_lb_theta(:,3), M.MPF_apost_ub_theta(:,3));
64title(' Parameters C(2,1)')
65subplot(4,1,4);
66plotestimates(fy.A(2,2)*ones(ndat,1), M.MPF_apost_mean_theta(:,4), M.MPF_apost_lb_theta(:,4), M.MPF_apost_ub_theta(:,4));
67title(' Parameters C(2,2)')
68
69
Note: See TracBrowser for help on using the browser.