How to break the iteration using an Error Equation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a 2D for loop iteration, I want to stop the iteration once change is less than a certain number! But I don't know how to recall the previous iteration?
Let's say equation is:
Iteration i=1:20000
x=function
y=function
result is A(x,y)
How to calculate change between the A at any i and i-1?
If I want the stop iterating (break the loop) when the change is <1 for example
I don't want to use A(x,y,i) code because my iteration sometimes stop changing at 20000 or so, that will require a huge memory
Thanks in advance
0 Kommentare
Antworten (1)
Walter Roberson
am 5 Dez. 2013
oldvalue = inf;
for i = 1 : 200000
x = function
y = function
T = value that will go into A(x,y)
A(x,y) = T;
if abs(T - oldvalue) < Tolerance
break
end
oldvalue = T;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Digital Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!