Revision 934, 0.7 kB
(checked in by smidl, 14 years ago)
|
use clear all + new mex
|
Rev | Line | |
---|
[934] | 1 | clear all |
---|
[724] | 2 | % name random variables |
---|
| 3 | y = RV({'y'},1); |
---|
[744] | 4 | u1 = RV({'u1'},1); |
---|
| 5 | u2 = RV({'u2'},1); |
---|
[724] | 6 | |
---|
| 7 | % create f(y_t| y_{t-3}, u_{t-1}) |
---|
| 8 | fy.class = 'mlnorm<ldmat>'; |
---|
| 9 | fy.rv = y; |
---|
[744] | 10 | fy.rvc = RVtimes([y,u1,u2], [-3, 0, 0]); |
---|
| 11 | fy.A = [0.5, -0.9, 0.9]; |
---|
[724] | 12 | fy.const = 0; |
---|
| 13 | fy.R = 1e-2; |
---|
| 14 | |
---|
| 15 | DS.class = 'PdfDS'; |
---|
| 16 | DS.pdf = fy; |
---|
| 17 | |
---|
| 18 | % create ARX estimator |
---|
| 19 | A1.class = 'ARX'; |
---|
| 20 | A1.rv = y; |
---|
[744] | 21 | A1.rgr = RVtimes([y,u1,u2],[-3,0,0]) ; % correct structure is {y,y} |
---|
[871] | 22 | A1.log_level ='logbounds,logevidence'; |
---|
[724] | 23 | |
---|
| 24 | C1.class = 'LQG_ARX'; |
---|
| 25 | C1.ARX = A1; |
---|
[745] | 26 | C1.Qu = 1*eye(2); |
---|
[724] | 27 | C1.Qy = eye(1); |
---|
| 28 | C1.yreq = 1; |
---|
| 29 | C1.horizon = 100; |
---|
| 30 | |
---|
[745] | 31 | M= controlloop(DS,{C1}); |
---|
[744] | 32 | |
---|
[745] | 33 | |
---|
| 34 | %%%%%%%%%%%%%%%%%%%%% |
---|
| 35 | % PLOT |
---|
| 36 | |
---|
| 37 | figure; |
---|
| 38 | subplot(2,1,1); |
---|
[933] | 39 | plot(M.DS_dt_y); |
---|
[745] | 40 | subplot(2,1,2); |
---|
| 41 | hold off |
---|
[933] | 42 | plot(M.DS_dt_u1); |
---|
[745] | 43 | hold on |
---|
[933] | 44 | plot(M.DS_dt_u2); |
---|