Clear Filters
Clear Filters

plotting using semilogy in a loop

6 views (last 30 days)
James Connor
James Connor on 1 Dec 2015
Answered: dpb on 1 Dec 2015
say I have
s= 0.604098184248020 0.642263089970519 3.73235669061904 0.147329697780077 0.238159152322172 0.0172071450520552 0.00180492811644228
the values for s are going to change each time my loop gets called. How do I plot them using semilogy() in which the x-axis is the number of values in s, this case the number is 7. And have it work so on the next call of semilogy in my loop it plots new values of s on the same figure.

Answers (1)

dpb
dpb on 1 Dec 2015
See
doc hold
Set
hold on
after the first iteration and add the subsequent lines. You'll want to cycle the color to distinguish the lines (altho seems like maybe I saw one change in later versions is that the color property isn't reset with hold any longer???? You can check easily enough)...

Categories

Find more on Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!