How to only plot the better result from a loop of 48 iterations in a convergence plot?

1 visualización (últimos 30 días)
hi, I'm running a complex program and i am required to plot the output of the program(resistance) in a convergence plot. if the first result is 900, if should only plot the lower resistance. Meaning, if the second iteration gives a result of 1000, the plot should remaina straight line at 900 under it reaches a value of less than 900. I have 48 results that i need to sort in a plot in this manner. Any ideas? Thank you

Respuestas (1)

Jon
Jon el 13 de Feb. de 2020
You could do something like this, assuming that your output is in vector y and iteration number is in vector iterCount
plot(iterCount,min(y,900))
  4 comentarios
Sasthikapreeya D/O Ponnarasu
Sasthikapreeya D/O Ponnarasu el 24 de Feb. de 2020
Hi, I did not manage to do it this way, had errors about logic. However, I managed to use a different approach by creating conditions then plotting it. Thank you for your help!
Jon
Jon el 24 de Feb. de 2020
I'm glad you got it working, but I'm curious about what "errors about logic" you had. I had run my suggested code on a little test program and it seemed to work as intended. Maybe there are some differences in the details of how you are handling the data.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by