How would I fix this code?

I'm not sure how to fix this error.

3 comentarios

James Tursa
James Tursa el 20 de Jul. de 2018
Please do not post images of code and text. Instead, copy & paste the entire code & entire error message into your Question as text, then highlight it and push the { } Code button to format it.
OCDER
OCDER el 20 de Jul. de 2018
The error message tells you how to fix the code sort of.
Error using eig
Input to EIG must not contain NaN or Inf.
Error in Rect (line 45)
[eig_vec, eig_val] = eig(I1I2)
Every time you get an error, you should do some basic debugging to resolve the problem:
  1. At this point, you should be thinking, "why does my input to eig have NaN or Inf?"
  2. What is in I1I2? Let's disp(I1I2)
  3. Hm, there is a NaN or Inf. Replace these with 0? Or prevent NaN and Inf calculation results in earlier steps?
Aquatris
Aquatris el 21 de Jul. de 2018
He has the same question in another post with his code copied. One of the variables in his function becomes a division by zero and becomes NaN, hence when the later variable that relies on the now NaN variable, eig function gives error.

Respuestas (0)

La pregunta está cerrada.

Preguntada:

el 20 de Jul. de 2018

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by