diff --git a/matlab/dyn_first_order_solver.m b/matlab/dyn_first_order_solver.m index a09aa1645..9fa4b05c2 100644 --- a/matlab/dyn_first_order_solver.m +++ b/matlab/dyn_first_order_solver.m @@ -1,53 +1,27 @@ -function [dr,info] = dyn_first_order_solver(jacobia,DynareModel,dr,DynareOptions,task) +function [dr, info] = dyn_first_order_solver(jacobia, DynareModel, dr, DynareOptions, task) -%@info: -%! @deftypefn {Function File} {[@var{dr},@var{info}] =} dyn_first_order_solver (@var{jacobia},@var{DynareModel},@var{dr},@var{DynareOptions},@var{task}) -%! @anchor{dyn_first_order_solver} -%! @sp 1 -%! Computes the first order reduced form of the DSGE model -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item jacobia -%! Matrix containing the Jacobian of the model -%! @item DynareModel -%! Matlab's structure describing the model (initialized by @code{dynare}). -%! @item dr -%! Matlab's structure describing the reduced form solution of the model. -%! @item qz_criterium -%! Double containing the criterium to separate explosive from stable eigenvalues -%! @end table -%! @sp 2 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item dr -%! Matlab's structure describing the reduced form solution of the model. -%! @item info -%! Integer scalar, error code. -%! @sp 1 -%! @table @ @code -%! @item info==0 -%! No error. -%! @item info==1 -%! The model doesn't determine the current variables uniquely. -%! @item info==2 -%! MJDGGES returned an error code. -%! @item info==3 -%! Blanchard & Kahn conditions are not satisfied: no stable equilibrium. -%! @item info==4 -%! Blanchard & Kahn conditions are not satisfied: indeterminacy. -%! @item info==5 -%! Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure. -%! @item info==7 -%! One of the generalized eigenvalues is close to 0/0 -%! @end table -%! @end table -%! @end deftypefn -%@eod: +% Computes the first order reduced form of a DSGE model. +% +% INPUTS +% - jacobia [double] matrix, the jacobian of the dynamic model. +% - DynareModel [struct] Matlab's structre describing the model, M_ global. +% - dr [struct] Matlab's structure describing the reduced form model. +% - DynareOptions [struct] Matlab's structure containing the current state of the options, oo_ global. +% - task [integer] scalar, if task = 0 then decision rules are computed and if task = 1 then only eigenvales are computed. +% +% OUTPUTS +% - dr [struct] Matlab's structure describing the reduced form model. +% - info [integer] scalar, error code. Possible values are: +% +% info=0 -> no error, +% info=1 -> the model doesn't determine the current variables uniquely, +% info=2 -> mjdgges dll returned an error, +% info=3 -> Blanchard and Kahn conditions are not satisfied: no stable equilibrium, +% info=4 -> Blanchard and Kahn conditions are not satisfied: indeterminacy, +% info=5 -> Blanchard and Kahn conditions are not satisfied: indeterminacy due to rank failure, +% info=7 -> One of the eigenvalues is close to 0/0 (infinity of complex solutions) -% Copyright (C) 2001-2017 Dynare Team +% Copyright (C) 2001-2018 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/stochastic_solvers.m b/matlab/stochastic_solvers.m index 6ba76fd5f..9b62f5a46 100644 --- a/matlab/stochastic_solvers.m +++ b/matlab/stochastic_solvers.m @@ -1,33 +1,28 @@ -function [dr,info] = stochastic_solvers(dr,task,M_,options_,oo_) -% function [dr,info,M_,options_,oo_] = stochastic_solvers(dr,task,M_,options_,oo_) -% computes the reduced form solution of a rational expectations model (first, second or third +function [dr, info] = stochastic_solvers(dr, task, M_, options_, oo_) + +% Computes the reduced form solution of a rational expectations model (first, second or third % order approximation of the stochastic model around the deterministic steady state). % % INPUTS -% dr [matlab structure] Decision rules for stochastic simulations. -% task [integer] if task = 0 then dr1 computes decision rules. -% if task = 1 then dr1 computes eigenvalues. -% M_ [matlab structure] Definition of the model. -% options_ [matlab structure] Global options. -% oo_ [matlab structure] Results +% - dr [struct] Decision rules for stochastic simulations. +% - task [integer] scalar, if task = 0 then decision rules are computed and if task = 1 then only eigenvales are computed. +% - M_ [struct] Definition of the model. +% - options_ [struct] Options. +% - oo_ [struct] Results % % OUTPUTS -% dr [matlab structure] Decision rules for stochastic simulations. -% info [integer] info=1: the model doesn't define current variables uniquely -% info=2: problem in mjdgges.dll info(2) contains error code. -% info=3: BK order condition not satisfied info(2) contains "distance" -% absence of stable trajectory. -% info=4: BK order condition not satisfied info(2) contains "distance" -% indeterminacy. -% info=5: BK rank condition not satisfied. -% info=6: The jacobian matrix evaluated at the steady state is complex. -% info=9: k_order_pert was unable to compute the solution -% ALGORITHM -% ... -% -% SPECIAL REQUIREMENTS -% none. +% - dr [struct] Decision rules for stochastic simulations. +% - info [integer] scalar, error code: % +% info=1 -> the model doesn't define current variables uniquely +% info=2 -> problem in mjdgges.dll info(2) contains error code. +% info=3 -> BK order condition not satisfied info(2) contains "distance" +% absence of stable trajectory. +% info=4 -> BK order condition not satisfied info(2) contains "distance" +% indeterminacy. +% info=5 -> BK rank condition not satisfied. +% info=6 -> The jacobian matrix evaluated at the steady state is complex. +% info=9 -> k_order_pert was unable to compute the solution % Copyright (C) 1996-2018 Dynare Team %