Skip to content
Snippets Groups Projects
Commit ee2c30fd authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Partialm cherry-pick of 28e95d817a181f758dab595d6a14de0ff348bed5

Give more informations in case of NaN, Inf or non real variables.

Closes PR #1385.
parent c24ebb60
No related branches found
No related tags found
No related merge requests found
......@@ -184,7 +184,33 @@ if stop
if verbose
skipline()
disp(sprintf('Total time of simulation: %s.', num2str(etime(clock,h1))))
dyy=reshape(dy,[size(endogenousvariables,1) periods])';
if ~isreal(res) || ~isreal(Y)
disp('Simulation terminated with imaginary parts in the residuals or endogenous variables.')
if any(~isreal(dy))
indx = find(any(~isreal(dyy)));
endo_names=cellstr(M.endo_names(indx,:));
disp('Newton algorithm provided complex number for variables:')
fprintf('%s, ', endo_names{:});
skipline()
end
else
disp('Simulation terminated with NaN or Inf in the residuals or endogenous variables.')
if any(isnan(dy))
indx = find(any(isnan(dyy)));
endo_names=cellstr(M.endo_names(indx,:));
disp('Newton algorithm provided NaN for variables:')
fprintf('%s, ',endo_names{:});
skipline()
end
if any(isinf(dy))
indx = find(any(isinf(dyy)));
endo_names=cellstr(M.endo_names(indx,:));
disp('Newton algorithm diverged (Inf) for variables:')
fprintf('%s, ',endo_names{:});
skipline()
end
end
disp('There is most likely something wrong with your model. Try model_diagnostics or another simulation method.')
printline(105)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment