Error using eig Input matrix contains NaN or Inf.
14 次查看(过去 30 天)
显示 更早的评论
Hi !
I am using surfaces ( trimesh containing triangles) in a Matlab. I am getting the error mentioned below;
Error using eig
Input matrix contains NaN or Inf.
Error in FASTGUI/RunEDButtonPushed (line 1474)
[Results(k).DTen(i).eeigVec, Results(k).DTen(i).eeigVal] = eig((Results(k).DTen(i).etensor +
Results(k).DTen(i).etensor')/2); % Expanded form because ML rounding errors was giving
non-symmetric tensor and complex numbers
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 410)
Error while evaluating Button PrivateButtonPushedFcn.
Any suggestions on how to fix NaN or inf errors?
Thanks!
3 个评论
Walter Roberson
2023-2-16
I cannot tell from that which of the parameters have NaN in them.
Are you interpolating to get surface coordinates? If so then which interpolation are you using? Some of the interpolations give NaN by default when the coordinates of interpolation are outside of the convex hull of the scattered points.
回答(1 个)
Sarthak
2023-3-9
Hi,
To fix this error, you need to identify the matrix that contains NaN or Inf values and handle them appropriately. Refer the following methods to fix the error:
- Check if any of the variables used to compute the matrix contains NaN or Inf values. Use the ‘isnan’ and ‘isinf’ functions to check if any of the variables contain NaN or Inf values.
- If NaN or Inf values are present in the matrix, you can replace them with appropriate values. For example, you can replace NaN values with zeros or the mean of the non-NaN values in the matrix.
In your case, it seems like the matrix ‘Results(k).DTen(i).etensor’ or ‘Results(k).DTen(i).etensor’ contains NaN or Inf values. You can use the above suggestions to identify and handle the NaN or Inf values appropriately.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!