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?

 채택된 답변

Star Strider
Star Strider 2016년 5월 25일

0 개 추천

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

Victoria Lucero
Victoria Lucero 2016년 5월 25일
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 2016년 5월 25일
NVM! my "x" within the fprintf command was wrong. Thank you for the help
Star Strider
Star Strider 2016년 5월 25일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2016년 5월 25일

댓글:

2016년 5월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by