Commit c82658a2 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

Bugfix for steady;

1.) Fixes cases where model was not truly linear, but Dynare did not catch mistake because fvec and jacob contained cancelling NaN
2.) Use correct error code 22 if NaN appear instead of generic 20
parent 01a8e881
......@@ -72,7 +72,16 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
fh_static = str2func([M.fname '_static']);
[fvec,jacob] = fh_static(ys_init,exo_ss, ...
params);
if max(abs(fvec)) > 1e-12
ii = find(~isfinite(fvec));
if ~isempty(ii)
ys=fvec;
check=1;
disp(['STEADY: numerical initial values or parameters incompatible with the following' ...
' equations'])
disp(ii')
disp('Check whether your model in truly linear')
elseif isempty(ii) && max(abs(fvec)) > 1e-12
ys = ys_init-jacob\fvec;
else
ys = ys_init;
......@@ -94,6 +103,9 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
resid = evaluate_static_model(ys_init,exo_ss,params,M,options);
end
info(2) = resid'*resid ;
if isnan(info(2))
info(1)=22;
end
return
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment