Debian Codegraph @

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

raw
1 function impgraphs(response,collabel,rowlabel)
2 %function impgraphs(response,collabel,rowlabel)
3 % collabel and rowlabel are cell arrays with string contents
4 %
5 % Copyright (C) 1997-2012 Tao Zha
6 %
7 % This free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
11 %
12 % It is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16 %
17 % If you did not received a copy of the GNU General Public License
18 % with this software, see <http://www.gnu.org/licenses/>.
19 %
20
21 XTick=[12 24 36 48]; %modify this line for other time units.
22 %XTickLabel=[] % Use this to suppress labeling.
23 [nrow,ncol,nt]=size(response);
24 for irow=1:nrow
25 smin=min(min(response(irow,:,:)));
26 smax=max(max(response(irow,:,:)));
27 if smin<0
28 if smax<=0
29 yt=[smin 0];
30 else
31 yt=[smin 0 smax];
32 end
33 else % (smin >=0)
34 if smax > 0
35 yt=[0 smax];
36 else % (identically zero responses)
37 yt=[-1 0 1];
38 end
39 end
40 for i=1:length(yt)
41 if yt(i)==0.0
42 if length(yt)==3 & -yt(1)<.2*yt(3)
43 ytc(i)={''};
44 else
45 ytc(i)={' 0'};
46 end
47 else
48 ytc(i)={sprintf('%2.4f',yt(i))};
49 end
50 end
51 scale=[1 nt smin smax];
52 for icol=1:ncol
53 subplot(nrow,ncol,(irow-1)*ncol+icol);
54 plot(squeeze(response(irow,icol,:)));grid
55 axis(scale);
56 if irow==1
57 title(collabel{icol});
58 end
59 if icol==1
60 ylabel(rowlabel{irow});
61 end
62 set(gca,'XTick',XTick)
63 set(gca,'YTick',yt)
64 if irow<nrow
65 set(gca,'XTickLabelMode','manual','XTickLabel',[])
66 end
67 if icol>1
68 set(gca,'YTickLabelMode','manual','YTickLabel',[])
69 else
70 set(gca,'YTickLabelMode','manual','YTickLabel',char(ytc))
71 end
72 end
73 end