Skip to content
Snippets Groups Projects
Commit 1b56a56e authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

dynare_solve.m: return with valid solution even if Jacobian is ill-behaved

In pathological cases, the Jacobian at the initial but true steady state value is ill-behaved. In this case we should return with the valid steady state instead of trying random starting values
parent 9036fae1
No related merge requests found
......@@ -78,6 +78,10 @@ if jacobian_flag
wrong_initial_guess_flag = false;
if ~all(isfinite(fvec)) || any(isinf(fjac(:))) || any(isnan((fjac(:)))) ...
|| any(~isreal(fvec)) || any(~isreal(fjac(:)))
if max(abs(fvec)) < tolf %return if initial value solves problem
info = 0;
return;
end
disp('Randomize initial guess...')
% Let's try random numbers for the variables initialized with the default value.
wrong_initial_guess_flag = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment