From 578fb045903e7eec3d4466111756d9cd036733ef Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Thu, 14 Jul 2016 15:04:27 +0200 Subject: [PATCH] Check for complexity of steady state in resid.m Residuals might be 0, but steady state might be complex, resulting in hard-to-diagnose problems when calling steady.m --- matlab/resid.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/matlab/resid.m b/matlab/resid.m index 5dda2a4cb..7383c1944 100644 --- a/matlab/resid.m +++ b/matlab/resid.m @@ -51,6 +51,16 @@ Sigma_e = M_.Sigma_e; M_.Sigma_e = zeros(size(Sigma_e)); info = 0; +if any(imag(oo_.steady_state)) + imagrow=find(imag(oo_.steady_state)); + if ~isempty(imagrow) + fprintf('\nresid: The initial values for the steady state of the following variables are complex:\n'); + for iter=1:length(imagrow) + fprintf('%s\n',M_.endo_names(imagrow(iter),:)); + end + end +end + if options_.steadystate_flag [oo_.steady_state,M_.params,info] = ... evaluate_steady_state(oo_.steady_state,M_,options_,oo_,0);