Home > matlab > steady.m

steady

PURPOSE ^

function steady()

SYNOPSIS ^

function steady()

DESCRIPTION ^

 function steady()
 computes and prints the steady state calculations
  
 INPUTS
   none
  
 OUTPUTS
   none

 SPECIAL REQUIREMENTS
   none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function steady()
0002 % function steady()
0003 % computes and prints the steady state calculations
0004 %
0005 % INPUTS
0006 %   none
0007 %
0008 % OUTPUTS
0009 %   none
0010 %
0011 % SPECIAL REQUIREMENTS
0012 %   none
0013 
0014 % Copyright (C) 2001-2012 Dynare Team
0015 %
0016 % This file is part of Dynare.
0017 %
0018 % Dynare is free software: you can redistribute it and/or modify
0019 % it under the terms of the GNU General Public License as published by
0020 % the Free Software Foundation, either version 3 of the License, or
0021 % (at your option) any later version.
0022 %
0023 % Dynare is distributed in the hope that it will be useful,
0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026 % GNU General Public License for more details.
0027 %
0028 % You should have received a copy of the GNU General Public License
0029 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0030 
0031 global M_ oo_ options_ ys0_ 
0032 
0033 test_for_deep_parameters_calibration(M_);
0034 
0035 if options_.steadystate_flag && options_.homotopy_mode
0036     error('STEADY: Can''t use homotopy when providing a steady state external file');
0037 end
0038 
0039 
0040 % Keep of a copy of M_.Sigma_e
0041 Sigma_e = M_.Sigma_e;
0042 
0043 % Set M_.Sigma_e=0 (we compute the *deterministic* steady state)
0044 M_.Sigma_e = zeros(size(Sigma_e));
0045 
0046 info = 0;
0047 switch options_.homotopy_mode
0048   case 1
0049     [M_,oo_,info,ip,ix,ixd] = homotopy1(options_.homotopy_values,options_.homotopy_steps,M_,options_,oo_);
0050   case 2
0051     homotopy2(options_.homotopy_values, options_.homotopy_steps);
0052   case 3
0053     [M_,oo_,info,ip,ix,ixd] = homotopy3(options_.homotopy_values,options_.homotopy_steps,M_,options_,oo_);
0054 end
0055 
0056 if info(1)
0057     hv = options_.homotopy_values;
0058     skipline()
0059     disp('WARNING: homotopy step was not completed')
0060     disp('The last values for which a solution was found are:')
0061     for i=1:length(ip)
0062         disp(sprintf('%12s %12.6f',M_.param_names(hv(ip(i),2),:), ...
0063                      M_.params(hv(ip(i),2))))
0064     end
0065     for i=1:length(ix)
0066         disp(sprintf('%12s %12.6f',M_.exo_names(hv(ix(i),2),:), ...
0067                      oo_.exo_steady_state(hv(ix(i),2))))
0068     end
0069     for i=1:length(ixd)
0070         disp(sprintf('%12s %12.6f',M_.exo_det_names(hv(ixd(i),2),:), ...
0071                      oo_.exo_det_steady_state(hv(ixd(i),2))))
0072     end
0073     
0074     if options_.homotopy_force_continue
0075         disp('Option homotopy_continue is set, so I continue ...')
0076     else
0077         error('Homotopy step failed')
0078     end
0079 end
0080     
0081 [steady_state,M_.params,info] = steady_(M_,options_,oo_);
0082 oo_.steady_state = steady_state;
0083 
0084 if info(1) == 0
0085     if options_.noprint == 0
0086         disp_steady_state(M_,oo_);
0087     end
0088 else
0089     if options_.noprint == 0
0090         if ~isempty(steady_state)
0091             resid;
0092         else
0093             skipline()
0094             disp('Residuals of the static equations cannot be computed because the steady state routine returned an empty vector.')
0095             skipline()
0096         end
0097     end
0098     if options_.debug
0099         fprintf('\nThe steady state computation failed. It terminated with the following values:\n')
0100         for i=1:M_.orig_endo_nbr
0101             fprintf('%s \t\t %g\n',M_.endo_names(i,:),steady_state(i));
0102         end        
0103     end
0104     print_info(info,options_.noprint, options_);
0105 end
0106 
0107 M_.Sigma_e = Sigma_e;

Generated on Sun 19-Feb-2017 20:43:00 by m2html © 2005