While loop stop when repeat answers

I am currently working on a while loop to get an estimate for pi^2/6. How do I stop the while loop one it starts to produce the same answer over and over?

Antworten (1)

Walter Roberson
Walter Roberson am 11 Jul. 2019

0 Stimmen

old = nan
New = nan
while old ~= New
old = New
New = whatever
end

Tags

Gefragt:

am 11 Jul. 2019

Beantwortet:

am 11 Jul. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by