root/applications/bdmtoolbox/tutorial/userguide/arx_basic_example.m @ 630

Revision 630, 1.1 kB (checked in by smidl, 15 years ago)

Tutorial update + new .m files

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
9
10A1.class = 'ARX';
11A1.rv = y;
12A1.rgr = RVtimes([y,u],[-3,-1]) ; % correct structure is {y,y}
13A1.options ='logbounds,logll';
14
15M=estimator(DS,{A1});
16
17%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18% plot results
19ndat = size(M.u,1);
20true_theta=[fy.A fy.const];
21true_R=[fy.R];
22
23subplot(1,2,1);
24hold off
25plot((true_theta' *ones(1,ndat))','-.');
26title(' Regression parameters \theta')
27hold on
28plot(M.mean_theta(1:ndat,:));
29co = get(gca,'ColorOrder');
30for i=1:size(M.mean_theta,2)
31    ind =1:10:ndat;
32    h=errorbar(ind,M.mean_theta(ind,i),...
33    M.mean_theta(ind,i)-M.lb_theta(ind,i),M.mean_theta(ind,i)-M.ub_theta(ind,i),'.');
34    set(h,'color',co(i,:));
35end
36
37set(gca,'YLim',[-1.5,1]);
38
39subplot(1,2,2);
40hold off
41plot(true_R*ones(1,ndat),'-.');
42title('Variance parameters r')
43hold on
44plot(M.mean_r(1:ndat,:));
45co = get(gca,'ColorOrder');
46ind =1:10:ndat;
47for i=1:size(M.mean_r, 2)
48    h=errorbar(ind,M.mean_r(ind,i),...
49    M.mean_r(ind,i)-M.lb_r(ind,i),M.mean_r(ind,i)-M.ub_r(ind,i),'.');
50    set(h,'color',co(i,:));
51end
Note: See TracBrowser for help on using the browser.