1 | theta = [0.8, -0.3, 0.4, 1.0;... |
---|
2 | 0.0, 0.0, 0.0, 0.0]; |
---|
3 | R = [0.1, 0.0; 0.0, 1.0]; |
---|
4 | |
---|
5 | |
---|
6 | y = struct('class','RV','names',{{'y'}}); |
---|
7 | y.class = 'RV'; |
---|
8 | y.names= {'y'}; |
---|
9 | |
---|
10 | u = struct('class','RV','names',{{'u'}}); |
---|
11 | %yu = struct('class','RV','names',{{'y','u'}}); |
---|
12 | rgr= struct('class','RV',... |
---|
13 | 'names',{{'y', 'y','y','u'}},... |
---|
14 | 'times' , [-1, -2, -3, -1]); |
---|
15 | |
---|
16 | %Data generating system |
---|
17 | system = struct(... |
---|
18 | 'class', 'ArxDS',... |
---|
19 | 'y', struct('class','RV','names',{{'y', 'u'}}),... |
---|
20 | 'u', struct('class','RV','names',{{}}),... |
---|
21 | 'rgr', rgr,... |
---|
22 | 'theta', theta,... |
---|
23 | 'offset', [0.0, 0.0],... |
---|
24 | 'r', R,... |
---|
25 | 'opt', 'L_theta'); |
---|
26 | |
---|
27 | % store results |
---|
28 | % logger = struct(... |
---|
29 | % 'class','dirfilelog',... |
---|
30 | % 'dirname','arx_test',... |
---|
31 | % 'maxlen', 1000); |
---|
32 | |
---|
33 | A1.class = 'ARX'; |
---|
34 | A1.rv = y; |
---|
35 | A1.rgr = rgr; |
---|
36 | A1.log_level ='logbounds,logevidence'; |
---|
37 | |
---|
38 | estimators = { A1}; |
---|
39 | |
---|
40 | %experiment description |
---|
41 | ndat = 90; |
---|
42 | experiment.ndat = ndat; |
---|
43 | |
---|
44 | M=estimator(system,estimators,experiment);%,logger); |
---|
45 | |
---|
46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
47 | % plot results |
---|
48 | |
---|
49 | subplot(1,2,1); |
---|
50 | hold off |
---|
51 | plot([M.tth(1:ndat,1:2:end) ],'-.'); |
---|
52 | title(' Regression parameters \theta') |
---|
53 | hold on |
---|
54 | plot(M.mean_theta(1:ndat,:)); |
---|
55 | co = get(gca,'ColorOrder'); |
---|
56 | for i=1:4 |
---|
57 | ind =1:10:ndat; |
---|
58 | h=errorbar(ind,M.mean_theta(ind,i),... |
---|
59 | M.mean_theta(ind,i)-M.lb_theta(ind,i),M.mean_theta(ind,i)-M.ub_theta(ind,i),'.'); |
---|
60 | set(h,'color',co(i,:)); |
---|
61 | end |
---|
62 | |
---|
63 | set(gca,'YLim',[-0.7,2]); |
---|
64 | |
---|
65 | subplot(1,2,2); |
---|
66 | hold off |
---|
67 | plot([M.rR(1:ndat) ],'-.'); |
---|
68 | title('Variance parameters r') |
---|
69 | hold on |
---|
70 | plot(M.mean_r(1:ndat,:)); |
---|
71 | co = get(gca,'ColorOrder'); |
---|
72 | ind =1:10:ndat; |
---|
73 | for i=1:size(M.mean_r, 2) |
---|
74 | h=errorbar(ind,M.mean_r(ind,i),... |
---|
75 | M.mean_r(ind,i)-M.lb_r(ind,i),M.mean_r(ind,i)-M.ub_r(ind,i),'.'); |
---|
76 | set(h,'color',co(i,:)); |
---|
77 | end |
---|