How can I plot an average line through this line graph

조회 수: 81 (최근 30일)
KJones
KJones 2016년 10월 26일
답변: Marco Wassmer 2016년 10월 26일
How can i plot the average of these line graphs onto the same graph?

채택된 답변

Marco Wassmer
Marco Wassmer 2016년 10월 26일
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

추가 답변 (1개)

Thorsten
Thorsten 2016년 10월 26일
You store the values of each line in the rows of matrix X. Then use
plot(mean(X))

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by