how to write a while-loop for a function
조회 수: 5 (최근 30일)
이전 댓글 표시
lim x-> inf (1 + 1/x)^x how to write a while-loop that repeats it self until the value of the subsequent numbers are less than 10^(-6)
댓글 수: 0
답변 (1개)
Doug Hull
2012년 10월 10일
flagMetTolerance = false
while ~flagMetTolerance
doMath
flagMetTolerance = (error <= tolerance)
end
댓글 수: 2
Jan
2012년 10월 10일
@Martin: Doug's program does the following: It is a while-loop, which calls the operation "doMath" repeatedly until a certain error value (the difference of subsequent elements in your case) is below the limit "tolerance".
I'm sure you will find out more details, if you are trying to use Matlab.
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!