Azzera filtri
Azzera filtri

how to write a while-loop for a function

2 visualizzazioni (ultimi 30 giorni)
Martin Svendsen
Martin Svendsen il 10 Ott 2012
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)

Risposte (1)

Doug Hull
Doug Hull il 10 Ott 2012
flagMetTolerance = false
while ~flagMetTolerance
doMath
flagMetTolerance = (error <= tolerance)
end
  2 Commenti
Martin Svendsen
Martin Svendsen il 10 Ott 2012
Could you help me to write the whole program. I am new to matlab and i dont really understand what you just wrote.
Jan
Jan il 10 Ott 2012
@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.

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by