[586] | 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 | |
---|
[412] | 6 | y = struct('class','RV','names',{{'y'}}); |
---|
[586] | 7 | y.class = 'RV'; |
---|
| 8 | y.names= {'y'}; |
---|
| 9 | |
---|
[412] | 10 | u = struct('class','RV','names',{{'u'}}); |
---|
[586] | 11 | %yu = struct('class','RV','names',{{'y','u'}}); |
---|
[414] | 12 | rgr= struct('class','RV',... |
---|
| 13 | 'names',{{'y', 'y','y','u'}},... |
---|
[412] | 14 | 'times' , [-1, -2, -3, -1]); |
---|
| 15 | |
---|
| 16 | %Data generating system |
---|
| 17 | system = struct(... |
---|
| 18 | 'class', 'ArxDS',... |
---|
| 19 | 'y', struct('class','RV','names',{{'y', 'u'}}),... |
---|
| 20 | 'u', struct('class','RV','names',{{}}),... |
---|
| 21 | 'rgr', rgr,... |
---|
[586] | 22 | 'theta', theta,... |
---|
[412] | 23 | 'offset', [0.0, 0.0],... |
---|
[586] | 24 | 'r', R,... |
---|
[412] | 25 | 'opt', 'L_theta'); |
---|
| 26 | |
---|
[586] | 27 | % store results |
---|
| 28 | % logger = struct(... |
---|
| 29 | % 'class','dirfilelog',... |
---|
| 30 | % 'dirname','arx_test',... |
---|
| 31 | % 'maxlen', 1000); |
---|
[412] | 32 | |
---|
[586] | 33 | A1.class = 'ARX'; |
---|
[630] | 34 | A1.rv = y; |
---|
[586] | 35 | A1.rgr = rgr; |
---|
| 36 | A1.options ='logbounds,logll'; |
---|
[412] | 37 | |
---|
[586] | 38 | estimators = { A1}; |
---|
| 39 | |
---|
[412] | 40 | %experiment description |
---|
[586] | 41 | ndat = 90; |
---|
| 42 | experiment.ndat = ndat; |
---|
[412] | 43 | |
---|
| 44 | M=estimator(system,estimators,experiment);%,logger); |
---|
[586] | 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 |
---|