Debian Codegraph @

contrib/ms-sbvar/TZcode/MatlabFiles/imcerrgraph.m

raw
1 function scaleout = imcerrgraph(imf,firstl,firsth,nvar,imstp,xlab,ylab)
2 % function scaleout = imcerrgraph(imf,firstl,firsth,nvar,imstp,xlab,ylab)
3 % imcerrgraph: impulse, c (column: shock 1 to N), error bands, graph
4 % imf: impulse responses, column (responses to 1st shock, responses to 2nd shock
5 % etc), row (impusle steps),
6 % firstl: lower band
7 % highth: high band
8 % nvar: number of variables
9 % imstp: step of impulse responses
10 % xlab,ylab: labels
11 %
12 % See imrgraph, imcerrgraph, imrerrgraph
13 %
14 % Copyright (C) 1997-2012 Tao Zha
15 %
16 % This free software: you can redistribute it and/or modify
17 % it under the terms of the GNU General Public License as published by
18 % the Free Software Foundation, either version 3 of the License, or
19 % (at your option) any later version.
20 %
21 % It is distributed in the hope that it will be useful,
22 % but WITHOUT ANY WARRANTY; without even the implied warranty of
23 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 % GNU General Public License for more details.
25 %
26 % If you did not received a copy of the GNU General Public License
27 % with this software, see <http://www.gnu.org/licenses/>.
28 %
29
30 t = 1:imstp;
31 temp1=zeros(nvar,1);
32 temp2=zeros(nvar,1);
33 maxval=zeros(nvar,1);
34 minval=zeros(nvar,1);
35 for i = 1:nvar
36 for j = 1:nvar
37 temp1(j)=max(firsth(:,(j-1)*nvar+i));
38 temp2(j)=min(firstl(:,(j-1)*nvar+i));
39 end
40 maxval(i)=max(temp1);
41 minval(i)=min(temp2);
42 end
43
44 scaleout = [maxval(:) minval(:)];
45
46 %--------------
47 % Column j: Shock 1 to N; Row i: Responses to
48 %-------------
49 figure
50 rowlabel = 1;
51 for i = 1:nvar
52 columnlabel = 1;
53 for j = 1:nvar
54 k1=(i-1)*nvar+j;
55 k2=(j-1)*nvar+i;
56 subplot(nvar,nvar,k1)
57 plot(t,imf(:,k2),t,[firstl(:,k2) firsth(:,k2)],':',...
58 t,zeros(length(imf(:,k2)),1),'-');
59 set(gca,'YLim',[minval(i) maxval(i)])
60 set(gca,'XTickLabel',' ');
61 set(gca,'YTickLabel',' ');
62 if rowlabel == 1
63 %title(['x' num2str(j)])
64 %title(eval(['x' num2str(j)]))
65 title(char(xlab(j)))
66 end
67 if columnlabel == 1
68 %ylabel(['x' num2str(i)])
69 %ylabel(eval(['x' num2str(i)]))
70 ylabel(char(ylab(i)))
71 end
72 columnlabel = 0;
73 end
74 rowlabel = 0;
75 end