output history and testing convergence

Hi there,
I have quite a complicated algorithm running and I would like to test to see if it converges as it is taking a very long time to run. How do I go about using my output from my while loops on each iteration, putting them into a graph so I can see if they converge??

 Respuesta aceptada

Matt J
Matt J el 27 de Jun. de 2013
Editada: Matt J el 27 de Jun. de 2013
x=nan(1,MaxIterations);
while i<=MaxIterations
...
x(i)=...
plot(x), drawnow
i=i+1
end
However, it's debatable whether this can give you true information about convergence, if you don't know what x(i) is converging to.

3 comentarios

Bran
Bran el 27 de Jun. de 2013
ank you! I will try this now. To be honestwhat the answer converges too is not really important, instead I need to see that the values between iterations are converging as my loop will stop once the matrices between consecutive iterations fail to differ by more than 0.1%
Bran
Bran el 27 de Jun. de 2013
Oh unfortunately my information is 3D and so plot wont work!
Matt J
Matt J el 27 de Jun. de 2013
Editada: Matt J el 27 de Jun. de 2013
instead I need to see that the values between iterations are converging as my loop will stop once the matrices between consecutive iterations fail to differ by more than 0.1%
OK, so as an example, the sequence log(i), i=1,..., will show decreasing percent differences between log(i) and log(i+1) that eventually converge to zero. But you don't care that log(i) ---> inf ?
Oh unfortunately my information is 3D and so plot wont work!
Consider PLOT3, SCATTER3, or any of the various 3D plotting commands.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 27 de Jun. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by