Debian Codegraph @

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

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