Changeset 586 for applications/bdmtoolbox/tutorial
- Timestamp:
- 08/27/09 15:39:35 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/tutorial/estimation/arx_test.m
r414 r586 1 theta = [0.8, -0.3, 0.4, 1.0;... 2 0.0, 0.0, 0.0, 0.0]; 3 R = [0.1, 0.0; 0.0, 1.0]; 4 5 1 6 y = struct('class','RV','names',{{'y'}}); 7 y.class = 'RV'; 8 y.names= {'y'}; 9 2 10 u = struct('class','RV','names',{{'u'}}); 3 yu = struct('class','RV','names',{{'y','u'}});11 %yu = struct('class','RV','names',{{'y','u'}}); 4 12 rgr= struct('class','RV',... 5 13 'names',{{'y', 'y','y','u'}},... … … 12 20 'u', struct('class','RV','names',{{}}),... 13 21 'rgr', rgr,... 14 'theta', [0.8, -0.3, 0.4, 1.0; 15 0.0, 0.0, 0.0, 0.0],... 22 'theta', theta,... 16 23 'offset', [0.0, 0.0],... 17 'r', [0.1, 0.0; 0.0, 1.0],...24 'r', R,... 18 25 'opt', 'L_theta'); 19 26 20 % store results21 logger = struct(...22 'class','dirfilelog',...23 'dirname','arx_test',...24 'maxlen', 1000);27 % store results 28 % logger = struct(... 29 % 'class','dirfilelog',... 30 % 'dirname','arx_test',... 31 % 'maxlen', 1000); 25 32 26 estimators = { 27 struct('class','ARX',... 28 'y', y,... 29 'rgr', rgr) 30 }; 33 A1.class = 'ARX'; 34 A1.y = y; 35 A1.rgr = rgr; 36 A1.options ='logbounds,logll'; 37 38 estimators = { A1}; 31 39 32 40 %experiment description 33 experiment.ndat = 9000; 41 ndat = 90; 42 experiment.ndat = ndat; 34 43 35 44 M=estimator(system,estimators,experiment);%,logger); 45 46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 % plot results 48 49 subplot(1,2,1); 50 hold off 51 plot([M.tth(1:ndat,1:2:end) ],'-.'); 52 title(' Regression parameters \theta') 53 hold on 54 plot(M.mean_theta(1:ndat,:)); 55 co = get(gca,'ColorOrder'); 56 for i=1:4 57 ind =1:10:ndat; 58 h=errorbar(ind,M.mean_theta(ind,i),... 59 M.mean_theta(ind,i)-M.lb_theta(ind,i),M.mean_theta(ind,i)-M.ub_theta(ind,i),'.'); 60 set(h,'color',co(i,:)); 61 end 62 63 set(gca,'YLim',[-0.7,2]); 64 65 subplot(1,2,2); 66 hold off 67 plot([M.rR(1:ndat) ],'-.'); 68 title('Variance parameters r') 69 hold on 70 plot(M.mean_r(1:ndat,:)); 71 co = get(gca,'ColorOrder'); 72 ind =1:10:ndat; 73 for i=1:size(M.mean_r, 2) 74 h=errorbar(ind,M.mean_r(ind,i),... 75 M.mean_r(ind,i)-M.lb_r(ind,i),M.mean_r(ind,i)-M.ub_r(ind,i),'.'); 76 set(h,'color',co(i,:)); 77 end