Any ideas on locating complex numbers in a matrix and changing their value to zero?
古いコメントを表示
Hello dear Mathworks world. I am having a little problem using the surf function in order to plot an energy surface with respect to two independent compositions (in a ternary system).
The problem seems to lie with the way I generate the solution, called Z. For some combinations of compositions, Z is is complex (which makes sense because they would be impossible in real life). However, the z matrix is quite large and changing these by hand would be intense (I cant even find them to be honest).
I was thinking of using something like: find(GS==nan) = 0; but this did not seem to work. Is there any way to set an elegant constraint on GS to not permit complex numbers in the solution space? I am still pretty new to the world of matlab so any advice is much appreciated.
Thank you! :)
採用された回答
その他の回答 (2 件)
Jos (10584)
2013 年 11 月 30 日
Take a look at isreal.
Z(~isreal(Z)) = 0 ;
カテゴリ
ヘルプ センター および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!