Fixed bug.
Rename options as options4fsolve, otherwise original options structure is lost.time-shift
parent
b7f8fb5710
commit
c97aaad62d
|
@ -86,18 +86,18 @@ if options.solve_algo == 0
|
||||||
error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
|
error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
options=optimset('fsolve');
|
options4fsolve=optimset('fsolve');
|
||||||
options.MaxFunEvals = 50000;
|
options4fsolve.MaxFunEvals = 50000;
|
||||||
options.MaxIter = options.steady.maxit;
|
options4fsolve.MaxIter = options.steady.maxit;
|
||||||
options.TolFun = tolf;
|
options4fsolve.TolFun = tolf;
|
||||||
options.Display = 'iter';
|
options4fsolve.Display = 'iter';
|
||||||
if jacobian_flag
|
if jacobian_flag
|
||||||
options.Jacobian = 'on';
|
Options4fsolve.Jacobian = 'on';
|
||||||
else
|
else
|
||||||
options.Jacobian = 'off';
|
Options4fsolve.Jacobian = 'off';
|
||||||
end
|
end
|
||||||
if ~isoctave
|
if ~isoctave
|
||||||
[x,fval,exitval,output] = fsolve(func,x,options,varargin{:});
|
[x,fval,exitval,output] = fsolve(func,x,options4fsolve,varargin{:});
|
||||||
else
|
else
|
||||||
% Under Octave, use a wrapper, since fsolve() does not have a 4th arg
|
% Under Octave, use a wrapper, since fsolve() does not have a 4th arg
|
||||||
func2 = str2func(func);
|
func2 = str2func(func);
|
||||||
|
@ -105,7 +105,7 @@ if options.solve_algo == 0
|
||||||
% The Octave version of fsolve does not converge when it starts from the solution
|
% The Octave version of fsolve does not converge when it starts from the solution
|
||||||
fvec = feval(func,x);
|
fvec = feval(func,x);
|
||||||
if max(abs(fvec)) >= tolf
|
if max(abs(fvec)) >= tolf
|
||||||
[x,fval,exitval,output] = fsolve(func,x,options);
|
[x,fval,exitval,output] = fsolve(func,x,options4fsolve);
|
||||||
else
|
else
|
||||||
exitval = 3;
|
exitval = 3;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue