| 1 | % load data created by the MpdfDS_example |
|---|
| 2 | load mpdfds_results |
|---|
| 3 | |
|---|
| 4 | DS.class = 'MemDS'; |
|---|
| 5 | DS.Data = Data; |
|---|
| 6 | DS.drv = drv; |
|---|
| 7 | |
|---|
| 8 | %%%%%% ARX estimator |
|---|
| 9 | |
|---|
| 10 | A1.class = 'ARX'; |
|---|
| 11 | A1.rv = y; |
|---|
| 12 | A1.rgr = RVtimes([y,u],[-3,-1]) ; % correct structure is {y,y} |
|---|
| 13 | A1.options ='logbounds,logll'; |
|---|
| 14 | |
|---|
| 15 | M=estimator(DS,{A1}); |
|---|
| 16 | |
|---|
| 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 18 | % plot results |
|---|
| 19 | ndat = size(M.u,1); |
|---|
| 20 | true_theta=[fy.A fy.const]; |
|---|
| 21 | true_R=[fy.R]; |
|---|
| 22 | |
|---|
| 23 | subplot(1,2,1); |
|---|
| 24 | hold off |
|---|
| 25 | plot((true_theta' *ones(1,ndat))','-.'); |
|---|
| 26 | title(' Regression parameters \theta') |
|---|
| 27 | hold on |
|---|
| 28 | plot(M.mean_theta(1:ndat,:)); |
|---|
| 29 | co = get(gca,'ColorOrder'); |
|---|
| 30 | for 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,:)); |
|---|
| 35 | end |
|---|
| 36 | |
|---|
| 37 | set(gca,'YLim',[-1.5,1]); |
|---|
| 38 | |
|---|
| 39 | subplot(1,2,2); |
|---|
| 40 | hold off |
|---|
| 41 | plot(true_R*ones(1,ndat),'-.'); |
|---|
| 42 | title('Variance parameters r') |
|---|
| 43 | hold on |
|---|
| 44 | plot(M.mean_r(1:ndat,:)); |
|---|
| 45 | co = get(gca,'ColorOrder'); |
|---|
| 46 | ind =1:10:ndat; |
|---|
| 47 | for 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,:)); |
|---|
| 51 | end |
|---|