discretionary_policy_1.m: check for NaN before checking for non-zero derivatives

Prevents false error message
time-shift
Johannes Pfeifer 2019-02-05 09:14:20 +01:00
parent 5c75c30104
commit 8cb99bfe9d
1 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,9 @@ if options_.steadystate_flag
options_,0);
end
[U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params);
if any(any(isnan(Uy)))
error(['discretionary_policy: the derivatives of the objective function contain NaN'])
end
if any(any(Uy~=0))
non_zero_derivs=find(any(Uy~=0));
for ii=1:length(non_zero_derivs)