Can divide by zero or infinity during the calculation be taken as zero?

10 ビュー (過去 30 日間)
Atique Khan
Atique Khan 2020 年 9 月 1 日
コメント済み: Atique Khan 2020 年 9 月 2 日
I am calculating S1=log10(1/A1) and sum all the Si where in some cases I get A=0 which leads to inf, making the final summation a problem. I used IFERROR command in MS Excel to avaoid 1/0 and assign it any other value I want as I can assign it zero to avoid porblem in summation. Kindly help How can I set S1 to zero if its an infinity.
Thanks in advance for the help.

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 9 月 1 日
You could use the isinf function.
S1(isinf(S1)) = 0;

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by