Revision 968, 0.7 kB
(checked in by smidl, 14 years ago)
|
New mexes + corrected tutorial
|
Line | |
---|
1 | clear all |
---|
2 | % name random variables |
---|
3 | y = RV({'y'},1); |
---|
4 | u1 = RV({'u1'},1); |
---|
5 | u2 = RV({'u2'},1); |
---|
6 | |
---|
7 | % create f(y_t| y_{t-3}, u_{t-1}) |
---|
8 | fy.class = 'mlnorm<ldmat>'; |
---|
9 | fy.rv = y; |
---|
10 | fy.rvc = RVtimes([y,u1,u2], [-3, 0, 0]); |
---|
11 | fy.A = [0.5, -0.9, 0.9]; |
---|
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.yrv = y; |
---|
21 | A1.rgr = RVtimes([y,u1,u2],[-3,0,0]) ; % correct structure is {y,y} |
---|
22 | A1.log_level ='logbounds,logevidence'; |
---|
23 | |
---|
24 | C1.class = 'LQG_ARX'; |
---|
25 | C1.ARX = A1; |
---|
26 | C1.Qu = 1*eye(2); |
---|
27 | C1.Qy = eye(1); |
---|
28 | C1.yreq = 1; |
---|
29 | C1.horizon = 100; |
---|
30 | |
---|
31 | M= controlloop(DS,{C1}); |
---|
32 | |
---|
33 | |
---|
34 | %%%%%%%%%%%%%%%%%%%%% |
---|
35 | % PLOT |
---|
36 | |
---|
37 | figure; |
---|
38 | subplot(2,1,1); |
---|
39 | plot(M.DS_dt_y); |
---|
40 | subplot(2,1,2); |
---|
41 | hold off |
---|
42 | plot(M.DS_dt_u1); |
---|
43 | hold on |
---|
44 | plot(M.DS_dt_u2); |
---|