root/applications/bdmtoolbox/tutorial/userguide/frg_estim.m @ 661

Revision 661, 1.5 kB (checked in by smidl, 15 years ago)

doc

Line 
1% load data created by the MpdfDS_example
2load mpdfds_results
3
4DS.class   = 'MemDS';
5DS.Data    = Data;
6DS.drv     = drv;
7
8%%%%%% ARX estimator conditioned on frg
9
10A1.class = 'ARXfrg';
11A1.rv = y;
12A1.rgr = RVtimes([y,u],[-3,-1]) ;
13A1.options ='logbounds,logll';
14A1.frg = 0.9;
15A1.name = 'A1';
16
17%%%%%% Random walk on frg - Dirichlet
18phi_pdf.class = 'mDirich';         % random walk on coefficient phi
19phi_pdf.rv    = RV('phi',2);       % 2D random walk - frg is the first element
20phi_pdf.k     = 0.01;              % width of the random walk
21phi_pdf.betac = [0.01 0.01];       % stabilizing elememnt of random walk
22
23%%%%%% Combining estimators in Marginalized particle filter
24E.class = 'MPF';
25E.BM = A1;                         % ARX is the analytical part
26E.parameter_pdf = phi_pdf;         % Random walk is the parameter evolution model
27E.res_threshold = 1.0;             % resampling parameter
28E.n = 20;                          % number of particles
29E.prior.class = 'eDirich';         % prior on non-linear part
30E.prior.beta  = [2 1]; %
31E.options ='logbounds,logll';
32E.name = 'MPF';
33
34M=estimator(DS,{E});
35
36%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37% plot results
38ndat = size(M.u,1);
39
40figure(1);
41subplot(2,2,1);
42plotestimates(true_theta, M.MPFmean_theta, M.MPFlb_theta, M.MPFub_theta);
43title(' Regression parameters \theta')
44set(gca,'YLim',[-1.5,1]);
45
46subplot(2,2,2);
47plotestimates(true_R, M.MPFmean_r,M.MPFlb_r,M.MPFub_r);
48title('Variance parameters r')
49
50subplot(2,2,3);
51plotestimates(1, M.MPFmean_phi(:,1),M.MPFlb_phi(:,1),M.MPFub_phi(:,1));
52title('Forgetting factor')
53
Note: See TracBrowser for help on using the browser.