Can i plot the mean of a number of graphs that are in the same plot

2 views (last 30 days)
Hello, In the same figure i have many different graphs. Is there a way to take the mean plot of those

Answers (2)

the cyclist
the cyclist on 13 Nov 2014
M = magic(5);
figure
hold on
plot(M)
plot(mean(M),'LineWidth',4)
  4 Comments
Pantelis Saviolakis
Pantelis Saviolakis on 13 Nov 2014
it is plotAverage which do this, but what i have to do in the previous example plotAverage(???).
the cyclist
the cyclist on 13 Nov 2014
Do you mean that you are using this plotAverage function from the File Exchange?
If so, I don't know anything about that. But maybe it has instructions. Try typing
help plotAverage

Sign in to comment.


Adam
Adam on 13 Nov 2014
Edited: Adam on 13 Nov 2014
How did your graphs get there?
Ideally keep the handles to the line plots (I assume they are line plots) when you plot them so you can access them again later without having to find axes children.
Even better just keep all the data you originally plotted, take its mean and add it to the same plot as all the rest using whatever properties of Line you want to make it stand out.
If you don't have the data, only the plots then you will have to extract the 'XData' and 'YData' properties of your line objects to do the maths on.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!