iterative when have Loop

조회 수: 6 (최근 30일)
Salam Al-Rubaye
Salam Al-Rubaye 2019년 10월 2일
댓글: Salam Al-Rubaye 2019년 10월 7일
Dear,
I have to assume X and used the value in three For Loop and the sum of the results of the loops should be zero. In each loop, I have a numerical solution.
What is the best way to do iterative to Find X?
Thanks,
  댓글 수: 1
Kevin Phung
Kevin Phung 2019년 10월 2일
can you be more clear? What do you mean by 'assume x'? It sounded like x was a constant, but then you are trying to solve for it? What are the loops doing? Provide an example for clarification

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 2일
편집: Walter Roberson 2019년 10월 2일
Put the code into a function that returns the sum of the three values, and then fzero() or fsolve() .
  댓글 수: 1
Salam Al-Rubaye
Salam Al-Rubaye 2019년 10월 7일
Thanks, that works.

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

추가 답변 (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