I have a column vector of n elements, i would like to calculate the mean with a step of 10 (the mean of 10th, 20th, and so on). thanks

 채택된 답변

Matt J
Matt J 2018년 8월 28일

0 개 추천

Or maybe you mean this,
out = mean(theVector(10:10:end))

댓글 수: 1

tilfani oussama
tilfani oussama 2018년 8월 28일
I think this, may aim us to compute the mean of 10ith, 20th, 30th... If we assume that the vector reflects daily profits, i would like to compute over the full period (length of the vector) the average profit each 10 days! Thank you for your reply

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

추가 답변 (1개)

Matt J
Matt J 2018년 8월 28일
편집: Matt J 2018년 8월 28일

0 개 추천

Assuming n is a multiple of 10 (otherwise you should pad the vector), you can use SEPBLOCKFUN (Download),
out = sepblockfun(theVector,[10,1],'mean')

댓글 수: 1

Matt J
Matt J 2018년 8월 28일
tiffani commented
I think this is not my aim, the output will be a simple number, which is the mean each 10th elements in the vector, with this function sepblockfun i get a vector as output

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

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2018년 8월 28일

댓글:

2018년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by