The initial values contains Inf or NaN

tesis.m (2.5 KB)
tesis.mod (7.9 KB)
tesis_steady.m (2.9 KB)
I’m reaching out for some guidance on a MATLAB issue I’ve encountered that I’m struggling to resolve. When running my code, I receive the following error message: “The Jacobian at the initial values contains Inf or NaN.” This occurs in various derivatives of equations with respect to different variables at their initial values as detailed below:

  • Derivative of Equation 13 with respect to Variable lambda (initial value of lambda: 0.140215)
  • Derivative of Equation 13 with respect to Variable y_ntni (initial value of y_ntni: 1)
  • Derivative of Equation 19 with respect to Variable y_ntni (initial value of y_ntni: 1)
  • Derivative of Equation 3 with respect to Variable k_ntni (initial value of k_ntni: 0)
  • Derivative of Equation 13 with respect to Variable k_ntni (initial value of k_ntni: 0)
  • Derivative of Equation 19 with respect to Variable k_ntni (initial value of k_ntni: 0)
  • Derivative of Equation 3 with respect to Variable h_ntni (initial value of h_ntni: 0.0753067)
  • Derivative of Equation 13 with respect to Variable p_ntni (initial value of p_ntni: 1)
  • Derivative of Equation 19 with respect to Variable p_ntni (initial value of p_ntni: 1)

I’ve checked for common issues such as division by zero or logarithms of non-positive numbers but haven’t been able to identify the cause of the Inf or NaN values in the Jacobian. I’m hoping someone here might have encountered a similar issue or could offer insight into potential causes and solutions.

Take the equation

((c - ((h_t^omega) / omega +(h_nti^omega) / omega +(h_ntni^omega)/ omega))^(-gamma)) = lambda;

The term

(c - ((h_t^omega) / omega +(h_nti^omega) / omega +(h_ntni^omega)/ omega))

is negative given your initial values. That will not work.