How can I plot an average line through this line graph
75 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
KJones
le 26 Oct 2016
Réponse apportée : Marco Wassmer
le 26 Oct 2016
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157426/image.png)
How can i plot the average of these line graphs onto the same graph?
0 commentaires
Réponse acceptée
Marco Wassmer
le 26 Oct 2016
assuming your data is stored in the vectors x1....x8 of the same length:
sum each component and divide by the number of lines:
x_mean=sum([x1,x2,x3,x4,x5,x6,x7,x8],2)./8
The plot in the plot:
plot(gca,time,x_mean);
if your time vectors are not the same then you will have to interpolate
0 commentaires
Plus de réponses (1)
Thorsten
le 26 Oct 2016
You store the values of each line in the rows of matrix X. Then use
plot(mean(X))
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!