Fix treatment of complex residuals in static models
The code part
if ~isreal(residual)
residual = real(residual)+imag(residual).^2;
end
allows accepting complex residuals if a negative real part offsets the squared imaginary part. Example: residual=-0.934942015344120 + 0.966923998191600i
. That may create cryptic error messages because the dynamic model does not have such a check and will correctly display residuals. That happens in OccBin where the static_and_dynamic_models_differ
check is triggered.