Objective value until convergence

5 vues (au cours des 30 derniers jours)
Chetan Fadnis
Chetan Fadnis le 1 Sep 2021
Commenté : Chetan Fadnis le 1 Sep 2021
I am writing a code which repeat until the convergence is reached. What decides the convergence of a objective? And how to repeat the code? I am using while loop for it. Can anyone suggest me any other methods. Thanks.

Réponse acceptée

Image Analyst
Image Analyst le 1 Sep 2021
You decide it. Then just have a while loop where you get the "objective" as you call it. The loop will break once your "objective" is less than your tolerance/threshold:
loopCounter = 1;
maxIterations = 9999999; % Failsafe
objective = inf;
threshold = 10; % Whatever...
while loopCounter < maxIterations && objective > threshold
objective = GetNewObjective(); % However you do it....
loopCounter = loopCounter + 1;
end
  1 commentaire
Chetan Fadnis
Chetan Fadnis le 1 Sep 2021
Thank you for your reply.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by