root/applications/bdmtoolbox/tutorial/userguide/arx_ctrl_example.m @ 968

Revision 968, 0.7 kB (checked in by smidl, 14 years ago)

New mexes + corrected tutorial

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