| 1 | % load data created by the MpdfDS_example |
|---|
| 2 | clear all |
|---|
| 3 | load pdfds_results |
|---|
| 4 | |
|---|
| 5 | DS.class = 'MemDS'; |
|---|
| 6 | DS.Data = Data; |
|---|
| 7 | DS.drv = drv; |
|---|
| 8 | |
|---|
| 9 | %%%%%% ARX estimator |
|---|
| 10 | |
|---|
| 11 | A1.class = 'ARX'; |
|---|
| 12 | A1.yrv = y; |
|---|
| 13 | A1.rv = RV({'theta','r'},[3,1]); |
|---|
| 14 | A1.rgr = RVtimes([y,u],[-3,-1]) ; % correct structure is {y,y} |
|---|
| 15 | A1.log_level = 'logbounds,logevidence'; |
|---|
| 16 | |
|---|
| 17 | A2.class = 'ARX'; |
|---|
| 18 | A2.yrv = u; |
|---|
| 19 | %A2.rv = RV({'theta','r'},[3,1]); |
|---|
| 20 | A2.rgr = RVtimes([y,u],[-3,-1]) ; % correct structure is {y,y} |
|---|
| 21 | A2.log_level = 'logbounds,logevidence'; |
|---|
| 22 | |
|---|
| 23 | P.class='ProdBM'; |
|---|
| 24 | P.BMs={A1,A2}; |
|---|
| 25 | P.log_level = 'logbounds'; |
|---|
| 26 | |
|---|
| 27 | [M,Apost]=estimator(DS,{P}); |
|---|
| 28 | |
|---|
| 29 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 30 | % plot results |
|---|
| 31 | ndat = size(M.DS_dt_u,1); |
|---|
| 32 | |
|---|
| 33 | subplot(1,2,1); |
|---|
| 34 | hold off |
|---|
| 35 | plotestimates(true_theta, ... |
|---|
| 36 | M.Est0_apost_mean_theta, ... |
|---|
| 37 | M.Est0_apost_lbound_theta, ... |
|---|
| 38 | M.Est0_apost_ubound_theta); |
|---|
| 39 | set(gca,'YLim',[-1.5,1]); |
|---|
| 40 | |
|---|
| 41 | subplot(1,2,2); |
|---|
| 42 | hold off |
|---|
| 43 | plotestimates(true_R, ... |
|---|
| 44 | M.Est0_apost_mean_r, ... |
|---|
| 45 | M.Est0_apost_lbound_r, ... |
|---|
| 46 | M.Est0_apost_ubound_r); |
|---|
| 47 | |
|---|
| 48 | title('Variance parameters r') |
|---|