필터 지우기
필터 지우기

Take the mean over multiple points in plot

조회 수: 5 (최근 30일)
jj27
jj27 2018년 10월 1일
댓글: Torsten 2018년 10월 1일
I want to calculate the mean over multiple points in a plot.
y = [12 17 16 15 56 45 24 86 65 41];
x = length(y);
now I want the mean over the first two points the second two points etc. But my real dataset is bigger than these 10 points so I need a loop for it, but don't know how to do it.

답변 (1개)

Torsten
Torsten 2018년 10월 1일
mean(reshape(y,2,numel(y)/2))
  댓글 수: 4
jj27
jj27 2018년 10월 1일
this function works but when I wanna change the number of values tot mean, it will give the same error.
so, when i want to change the 2 into 60 values it doesn't work
Torsten
Torsten 2018년 10월 1일
Is the lenghth of the y-array divisible by 60 ? What do you want to do if this is not the case ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by