x = 0 to 5 decimal places?

3 visualizaciones (últimos 30 días)
Chris Potts
Chris Potts el 30 de En. de 2018
Comentada: Chris Potts el 30 de En. de 2018
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de En. de 2018
while abs(z(end)) > 1e-5
  1 comentario
Chris Potts
Chris Potts el 30 de En. de 2018
Cheers, worked a treat :D

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by