From 8fc0409ab6708ef1cfe03a1c7da1fd0d69f5e551 Mon Sep 17 00:00:00 2001
From: michel <michel@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Fri, 20 Mar 2009 10:28:28 +0000
Subject: [PATCH] 4.0: merged r2283 changeset from trunk (constant estimation
 bug fix. Diminished tolerance in recomputation of steady state for linear
 models)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2484 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/resol.m | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/matlab/resol.m b/matlab/resol.m
index e22e7bfa05..6ec9aa70dc 100644
--- a/matlab/resol.m
+++ b/matlab/resol.m
@@ -67,18 +67,22 @@ if options_.steadystate_flag
 			 [oo_.exo_steady_state; oo_.exo_det_steady_state]);
 else
   % testing if ys isn't a steady state or if we aren't computing Ramsey policy
-  if max(abs(feval(fh,dr.ys,[oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params))) ...
-	> options_.dynatol & options_.ramsey_policy == 0
-    if options_.linear == 0
-      % nonlinear models
-      [dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,...
-				    [oo_.exo_steady_state; ...
+  if  options_.ramsey_policy == 0
+      if options_.linear == 0
+          % nonlinear models
+          if max(abs(feval(fh,dr.ys,[oo_.exo_steady_state; ...
+                    oo_.exo_det_steady_state], M_.params))) > options_.dynatol
+              [dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,...
+                                            [oo_.exo_steady_state; ...
 		    oo_.exo_det_steady_state], M_.params);
-    else
-      % linear models
-      [fvec,jacob] = feval(fh,dr.ys,[oo_.exo_steady_state;...
+          end
+      else
+          % linear models
+          [fvec,jacob] = feval(fh,dr.ys,[oo_.exo_steady_state;...
 		    oo_.exo_det_steady_state], M_.params);
-      dr.ys = dr.ys-jacob\fvec;
+          if max(abs(fvec)) > 1e-12
+              dr.ys = dr.ys-jacob\fvec;
+          end
     end
   end
 end
-- 
GitLab