how can I avoid this error: Error using eig EIG did not converge.

7 次查看(过去 30 天)
I want to find eigenvalu and eigenvector using "eig" function in matlab, but sometimes I get this error:
Error using eig EIG did not converge.
how can I avoid this error or what can I do the code run again automatically if this error happens?

采纳的回答

Jan
Jan 2013-7-5
Are you looking for TRY/CATCH?
  2 个评论
Jan
Jan 2017-3-21
You explained, that your code fails sometimes. Then including the failing command in TRY/CATCH allows to run a fallback method or some error handling:
try
[V, D] = eig(X);
catch ME
warning(ME.message);
[V,D] = EIG(X, 'nobalance'); % For example
end
It depends on your calculations, if the problem can be avoided or what "automatic" can help get the wanted result. Without knowing any details about your code, I can suggest only a general strategy.

请先登录,再进行评论。

更多回答(1 个)

Marco Gambacciani
Marco Gambacciani 2017-3-17

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by