


function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadystate_check_flag)
Computes the steady state
INPUTS
ys_init vector initial values used to compute the steady
state
M struct model structure
options struct options
oo struct output results
steadystate_check_flag boolean if true, check that the
steadystate verifies the
static model
OUTPUTS
ys vector steady state
params vector model parameters possibly
modified by user steadystate
function
info 2x1 vector error codes
SPECIAL REQUIREMENTS
none

0001 function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadystate_check_flag) 0002 % function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadystate_check_flag) 0003 % Computes the steady state 0004 % 0005 % INPUTS 0006 % ys_init vector initial values used to compute the steady 0007 % state 0008 % M struct model structure 0009 % options struct options 0010 % oo struct output results 0011 % steadystate_check_flag boolean if true, check that the 0012 % steadystate verifies the 0013 % static model 0014 % 0015 % OUTPUTS 0016 % ys vector steady state 0017 % params vector model parameters possibly 0018 % modified by user steadystate 0019 % function 0020 % info 2x1 vector error codes 0021 % 0022 % SPECIAL REQUIREMENTS 0023 % none 0024 0025 % Copyright (C) 2001-2011 Dynare Team 0026 % 0027 % This file is part of Dynare. 0028 % 0029 % Dynare is free software: you can redistribute it and/or modify 0030 % it under the terms of the GNU General Public License as published by 0031 % the Free Software Foundation, either version 3 of the License, or 0032 % (at your option) any later version. 0033 % 0034 % Dynare is distributed in the hope that it will be useful, 0035 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0036 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0037 % GNU General Public License for more details. 0038 % 0039 % You should have received a copy of the GNU General Public License 0040 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0041 0042 info = 0; 0043 check = 0; 0044 0045 steadystate_flag = options.steadystate_flag; 0046 params = M.params; 0047 exo_ss = [oo.exo_steady_state; oo.exo_det_steady_state]; 0048 0049 if length(M.aux_vars) > 0 0050 h_set_auxiliary_variables = str2func([M.fname '_set_auxiliary_variables']); 0051 ys_init = h_set_auxiliary_variables(ys_init,exo_ss,M.params); 0052 end 0053 0054 if options.ramsey_policy 0055 [ys,params] = dyn_ramsey_static(ys_init,M,options,oo); 0056 elseif steadystate_flag 0057 % explicit steady state file 0058 [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, ... 0059 options); 0060 if info(1) 0061 return; 0062 end 0063 elseif (options.bytecode == 0 && options.block == 0) 0064 if options.linear == 0 0065 % non linear model 0066 [ys,check] = dynare_solve([M.fname '_static'],... 0067 ys_init,... 0068 options.jacobian_flag, ... 0069 exo_ss, params); 0070 else 0071 % linear model 0072 fh_static = str2func([M.fname '_static']); 0073 [fvec,jacob] = fh_static(ys_init,exo_ss, ... 0074 params); 0075 if max(abs(fvec)) > 1e-12 0076 ys = ys_init-jacob\fvec; 0077 else 0078 ys = ys_init; 0079 end 0080 0081 end 0082 else 0083 % block or bytecode 0084 [ys,check] = dynare_solve_block_or_bytecode(ys_init,exo_ss, params, ... 0085 options, M); 0086 end 0087 0088 if check 0089 if options.steadystate_flag 0090 info(1)= 19; 0091 resid = check1 ; 0092 else 0093 info(1)= 20; 0094 resid = evaluate_static_model(ys_init,exo_ss,params,M,options); 0095 end 0096 info(2) = resid'*resid ; 0097 return 0098 end 0099 0100 if ~isreal(ys) 0101 info(1) = 21; 0102 info(2) = sum(imag(ys).^2); 0103 ys = real(ys); 0104 return 0105 end 0106 0107 if ~isempty(find(isnan(ys))) 0108 info(1) = 22; 0109 info(2) = NaN; 0110 return 0111 end 0112