diff --git a/matlab/mr_gstep.m b/matlab/mr_gstep.m index 7c36e1017..6a0e7f927 100644 --- a/matlab/mr_gstep.m +++ b/matlab/mr_gstep.m @@ -89,7 +89,11 @@ while i(2*htol), h1(i)= htol/abs(dx(it))*h1(i); xh1(i)=x(i)+h1(i); - [fx, ffx]=feval(func,xh1,varargin{:}); + try + [fx, ffx]=feval(func,xh1,varargin{:}); + catch + fx=1.e8; + end while (fx-f0)==0, h1(i)= h1(i)*2; xh1(i)=x(i)+h1(i); diff --git a/matlab/newrat.m b/matlab/newrat.m index 87d353bfb..7e5992243 100644 --- a/matlab/newrat.m +++ b/matlab/newrat.m @@ -197,7 +197,11 @@ while norm(gg)>gtol & check==0 & jit1.e-12, + try save m1 x fval0 nig -append + catch + save m1 x fval0 nig + end [dum, gg, htol0, igg, hhg]=mr_hessian(func_hh,xparam1,flagit,htol,varargin{:}); if htol0>htol, %ftol, %ftol=htol0;