x = 0 to 5 decimal places?

2 ビュー (過去 30 日間)
Chris Potts
Chris Potts 2018 年 1 月 30 日
コメント済み: Chris Potts 2018 年 1 月 30 日
Hey guys
I have written a while statement...
"while z(end) ~= 0;"
Basically if z = 0 i want the while loop to end. At the moment my z comes out at 5.6843*10^-14.
This is the closest I'm going to get to 0 and I'm happy for the loop to end. How would I go about setting the while loop to close after 5 decimal places?

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 30 日
while abs(z(end)) > 1e-5
  1 件のコメント
Chris Potts
Chris Potts 2018 年 1 月 30 日
Cheers, worked a treat :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by