From e45bf380fa30a081cb72aef924622499555eb903 Mon Sep 17 00:00:00 2001 From: michel Date: Thu, 9 Apr 2009 15:35:07 +0000 Subject: [PATCH] 4.1: modified csminwel.m to make sure to choose always the lowest point, even if it was reached before the last traversing git-svn-id: https://www.dynare.org/svn/dynare/trunk@2582 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/csminwel.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/csminwel.m b/matlab/csminwel.m index e3439d840..468c150ec 100644 --- a/matlab/csminwel.m +++ b/matlab/csminwel.m @@ -217,10 +217,10 @@ while ~done f2=f;f3=f;f1=f;retcode2=retcode1;retcode3=retcode1; end %how to pick gh and xh - if f3 < f - crit & badg3==0 + if f3 < f - crit & badg3==0 & f3 < f2 & f3 < f1 ih=3; fh=f3;xh=x3;gh=g3;badgh=badg3;retcodeh=retcode3; - elseif f2 < f - crit & badg2==0 + elseif f2 < f - crit & badg2==0 & f2 < f1 ih=2; fh=f2;xh=x2;gh=g2;badgh=badg2;retcodeh=retcode2; elseif f1 < f - crit & badg1==0