the answer is suppose to be x = 1.58, but it is printing every x value up to 1.58. What is wrong with my code?

 Respuesta aceptada

Star Strider
Star Strider el 25 de Mayo de 2016

0 votos

I didn’t run your code (I didn’t feel like typing it in).
See if replacing your if block condition with ‘y(i+1)’ works:
if (y(i+1) < 0)

3 comentarios

Victoria Lucero
Victoria Lucero el 25 de Mayo de 2016
So it now stops at 1.58 (which is the answer) but it is still printing every value. Where should I put the fprintf?
Victoria Lucero
Victoria Lucero el 25 de Mayo de 2016
NVM! my "x" within the fprintf command was wrong. Thank you for the help
Star Strider
Star Strider el 25 de Mayo de 2016
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 25 de Mayo de 2016

Comentada:

el 25 de Mayo de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by