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

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

doc estimation + ARX corrections

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);
20
21subplot(1,2,1);
22hold off
23plot((true_theta' *ones(1,ndat))','-.');
24title(' Regression parameters \theta')
25hold on
26plot(M.mean_theta(1:ndat,:));
27co = get(gca,'ColorOrder');
28for i=1:size(M.mean_theta,2)
29    ind =1:10:ndat;
30    h=errorbar(ind,M.mean_theta(ind,i),...
31    M.mean_theta(ind,i)-M.lb_theta(ind,i),M.mean_theta(ind,i)-M.ub_theta(ind,i),'.');
32    set(h,'color',co(i,:));
33end
34
35set(gca,'YLim',[-1.5,1]);
36
37subplot(1,2,2);
38hold off
39plot(true_R*ones(1,ndat),'-.');
40title('Variance parameters r')
41hold on
42plot(M.mean_r(1:ndat,:));
43co = get(gca,'ColorOrder');
44ind =1:10:ndat;
45for i=1:size(M.mean_r, 2)
46    h=errorbar(ind,M.mean_r(ind,i),...
47    M.mean_r(ind,i)-M.lb_r(ind,i),M.mean_r(ind,i)-M.ub_r(ind,i),'.');
48    set(h,'color',co(i,:));
49end
Note: See TracBrowser for help on using the browser.