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

Revision 871, 0.7 kB (checked in by mido, 14 years ago)

adaptation of /applications to new version of LOG_LEVEL
also, a cosmetic change made in enumerations: logub -> logubound, loglb -> loglbound

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