x = 0 to 5 decimal places?

조회 수: 3 (최근 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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by