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

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

Move logfull out of epdf.

  • Property svn:eol-style set to native
RevLine 
[934]1clear all
[640]2% load data created by the MpdfDS_example
[709]3load pdfds_results
[640]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]) ;
[924]14A1.log_level = 'logbounds';
[904]15A1.frg = 0.98;
[640]16A1.name = 'A1';
17
[895]18
[640]19%%%%%% Random walk on frg - Dirichlet
20phi_pdf.class = 'mDirich';         % random walk on coefficient phi
[700]21phi_pdf.rv    = RV({'phi','1_phi'});       % 2D random walk - frg is the first element
[640]22phi_pdf.k     = 0.01;              % width of the random walk
[895]23phi_pdf.betac = [0.1 0.1];         % stabilizing elememnt of random walk
[640]24
[895]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
[640]31%%%%%% Combining estimators in Marginalized particle filter
[895]32E.class = 'PF';
33E.particle = p;                    % ARX is the analytical part
[950]34E.res_threshold = 0.90;             % resampling parameter
[900]35E.n = 100;                          % number of particles
[640]36E.prior.class = 'eDirich';         % prior on non-linear part
[661]37E.prior.beta  = [2 1]; %
[950]38E.log_level = 'logbounds,logweights,logmeans';
[640]39E.name = 'MPF';
40
[900]41[M,Str]=estimator(DS,{E});
[640]42
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44% plot results
[924]45ndat = size(M.DS_dt_u,1);
[640]46
47figure(1);
48subplot(2,2,1);
[924]49plotestimates(true_theta, M.MPF_apost_mean_theta, M.MPF_apost_lbound_theta, M.MPF_apost_ubound_theta);
[640]50title(' Regression parameters \theta')
51set(gca,'YLim',[-1.5,1]);
52
53subplot(2,2,2);
[924]54plotestimates(true_R, M.MPF_apost_mean_r,M.MPF_apost_lbound_r,M.MPF_apost_ubound_r);
[640]55title('Variance parameters r')
56
57subplot(2,2,3);
[924]58plotestimates(1, M.MPF_apost_mean_phi(:,1),M.MPF_apost_lbound_phi(:,1),M.MPF_apost_ubound_phi(:,1));
[640]59title('Forgetting factor')
60
[950]61
62for i=1:E.n
63   
Note: See TracBrowser for help on using the browser.