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

Revision 950, 1.8 kB (checked in by smidl, 14 years ago)

Move logfull out of epdf.

  • Property svn:eol-style set to native
Line 
1clear all
2% load data created by the MpdfDS_example
3load pdfds_results
4
5DS.class   = 'MemDS';
6DS.Data    = Data;
7DS.drv     = drv;
8
9%%%%%% ARX estimator conditioned on frg
10
11A1.class = 'ARXfrg';
12A1.rv = y;
13A1.rgr = RVtimes([y,u],[-3,-1]) ;
14A1.log_level = 'logbounds';
15A1.frg = 0.98;
16A1.name = 'A1';
17
18
19%%%%%% Random walk on frg - Dirichlet
20phi_pdf.class = 'mDirich';         % random walk on coefficient phi
21phi_pdf.rv    = RV({'phi','1_phi'});       % 2D random walk - frg is the first element
22phi_pdf.k     = 0.01;              % width of the random walk
23phi_pdf.betac = [0.1 0.1];         % stabilizing elememnt of random walk
24
25%%%%%% Particle
26p.class = 'MarginalizedParticle';
27p.parameter_pdf = phi_pdf;         % Random walk is the parameter evolution model
28p.bm    = A1;
29
30% prior on ARX
31%%%%%% Combining estimators in Marginalized particle filter
32E.class = 'PF';
33E.particle = p;                    % ARX is the analytical part
34E.res_threshold = 0.90;             % resampling parameter
35E.n = 100;                          % number of particles
36E.prior.class = 'eDirich';         % prior on non-linear part
37E.prior.beta  = [2 1]; %
38E.log_level = 'logbounds,logweights,logmeans';
39E.name = 'MPF';
40
41[M,Str]=estimator(DS,{E});
42
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44% plot results
45ndat = size(M.DS_dt_u,1);
46
47figure(1);
48subplot(2,2,1);
49plotestimates(true_theta, M.MPF_apost_mean_theta, M.MPF_apost_lbound_theta, M.MPF_apost_ubound_theta);
50title(' Regression parameters \theta')
51set(gca,'YLim',[-1.5,1]);
52
53subplot(2,2,2);
54plotestimates(true_R, M.MPF_apost_mean_r,M.MPF_apost_lbound_r,M.MPF_apost_ubound_r);
55title('Variance parameters r')
56
57subplot(2,2,3);
58plotestimates(1, M.MPF_apost_mean_phi(:,1),M.MPF_apost_lbound_phi(:,1),M.MPF_apost_ubound_phi(:,1));
59title('Forgetting factor')
60
61
62for i=1:E.n
63   
Note: See TracBrowser for help on using the browser.