Home > matlab > rplot.m

rplot

PURPOSE ^

function rplot(s1)

SYNOPSIS ^

function rplot(s1)

DESCRIPTION ^

 function rplot(s1)

 Plots the simulated trajectory of one or several variables.
 The entire simulation period is plotted, unless instructed otherwise
 with "dsample".

 INPUTS
    s1:           character matrix of variable names

 OUTPUTS
    none

 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rplot(s1)
0002 % function rplot(s1)
0003 %
0004 % Plots the simulated trajectory of one or several variables.
0005 % The entire simulation period is plotted, unless instructed otherwise
0006 % with "dsample".
0007 %
0008 % INPUTS
0009 %    s1:           character matrix of variable names
0010 %
0011 % OUTPUTS
0012 %    none
0013 %
0014 % SPECIAL REQUIREMENTS
0015 %    none
0016 
0017 % Copyright (C) 2001-2009 Dynare Team
0018 %
0019 % This file is part of Dynare.
0020 %
0021 % Dynare is free software: you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation, either version 3 of the License, or
0024 % (at your option) any later version.
0025 %
0026 % Dynare is distributed in the hope that it will be useful,
0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0029 % GNU General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License
0032 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 global M_ oo_ options_
0035 
0036 rplottype = options_.rplottype;
0037 
0038 col = ['y','c','r','g','b','w','m'] ;
0039 ix = [1 - M_.maximum_lag:size(oo_.endo_simul,2)-M_.maximum_lag]' ;
0040 
0041 y = [];
0042 for k=1:size(s1,1)
0043     if isempty(strmatch(s1(k,:),M_.endo_names,'exact'))
0044         error (['One of the variable specified does not exist']) ;
0045     end
0046 
0047     y = [y; oo_.endo_simul(strmatch(s1(k,:),M_.endo_names,'exact'),:)] ;
0048 end
0049 
0050 if options_.smpl == 0
0051     i = [max(1, M_.maximum_lag):size(oo_.endo_simul,2)]' ;
0052 else
0053     i = [options_.smpl(1)+M_.maximum_lag:options_.smpl(2)+M_.maximum_lag]' ;
0054 end
0055 
0056 t = ['Plot of '] ;
0057 if rplottype == 0
0058     for j = 1:size(y,1)
0059         t = [t s1(j,:) ' '] ;
0060     end
0061     figure ;
0062     plot(ix(i),y(:,i)) ;
0063     title (t,'Interpreter','none') ;
0064     xlabel('Periods') ;
0065     if size(s1,1) > 1
0066         if exist('OCTAVE_VERSION')
0067             legend(s1, 0);
0068         else
0069             h = legend(s1,0);
0070             set(h, 'Interpreter', 'none');
0071         end
0072     end
0073 elseif rplottype == 1
0074     for j = 1:size(y,1)
0075         figure ;
0076         plot(ix(i),y(j,i)) ;
0077         title(['Plot of ' s1(:,j)]) ;
0078         xlabel('Periods') ;
0079     end
0080 elseif rplottype == 2
0081     figure ;
0082     nl = max(1,fix(size(y,1)/4)) ;
0083     nc = ceil(size(y,1)/nl) ;
0084     for j = 1:size(y,1)
0085         subplot(nl,nc,j) ;
0086         plot(ix(i),y(j,i)) ;
0087         hold on ;
0088         plot(ix(i),oo_.steady_state(j)*ones(1,size(i,1)),'w:') ;
0089         xlabel('Periods') ;
0090         ylabel([s1(:,j)]) ;
0091         title(['Plot of ' s1(:,j)]) ;
0092     end
0093 end
0094 
0095 % 02/28/01 MJ replaced bseastr by MATLAB's strmatch
0096 % 06/19/01 MJ added 'exact' to strmatch calls
0097 % 06/25/03 MJ correction when options_.smpl ~= 0
0098 
0099 
0100 
0101 
0102 
0103 
0104 
0105 
0106

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005