Can i plot the mean of a number of graphs that are in the same plot
2 views (last 30 days)
Show older comments
Hello, In the same figure i have many different graphs. Is there a way to take the mean plot of those
0 Comments
Answers (2)
the cyclist
on 13 Nov 2014
M = magic(5);
figure
hold on
plot(M)
plot(mean(M),'LineWidth',4)
4 Comments
the cyclist
on 13 Nov 2014
If so, I don't know anything about that. But maybe it has instructions. Try typing
help plotAverage
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.
2 Comments
See Also
Categories
Find more on 2-D and 3-D Plots 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!