フィルターのクリア

Error using eig Input matrix contains NaN or Inf.

15 ビュー (過去 30 日間)
Omer Iqbal
Omer Iqbal 2023 年 2 月 16 日
回答済み: Sarthak 2023 年 3 月 9 日
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 件のコメント
Omer Iqbal
Omer Iqbal 2023 年 2 月 16 日
Hey!
Thanks! I put a breakpoint at line 1474 and have noticed that several parameters have NaN values in it ( Please see attached snapshot)
I used the dbstop if nanif but it didnot work for me and gave me same errors. I am not sure where the problem is located either its in the input ( surfaces) or some parameters.
Walter Roberson
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
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:
  1. Check if any of the variables used to compute the matrix contains NaN or Inf values. Use the ‘isnan and ‘isinffunctions to check if any of the variables contain NaN or Inf values.
  2. 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.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by