How to take average of lines in Plot & Plot it as one graph?

22 visualizaciones (últimos 30 días)
Nihar Jariwala
Nihar Jariwala el 18 de Abr. de 2021
Hi Guys,
I have a graph with 140 lines, each of them having 200 points. I want to plot one line that has to be the average of 1 graph.
For Example: 1st Point = Averages of all the 1st Point of 140 lines.
2nd Point = Averages of all the 2nd Point of 140 lines.
Thanks.

Respuestas (1)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato el 18 de Abr. de 2021
Do you have access to the data of all those graphs as a matrix? If so you can do it in a very straight forward way:
data = randn(200,140); % Substitute by your data
dimensionContainingTheLines = 2;
averageResult = mean(data,dimensionContainingTheLines);
plot(data,'color',[0.9,0.9,0.9]); hold on
plot(averageResult,'linewidth',4);

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by