Debian Codegraph @

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

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