how to do running mean?

3 次查看(过去 30 天)
Lilya
Lilya 2020-10-22
评论: Lilya 2020-10-25
Hi all,
I have a 3d matrix with a dimension of 21*41*273, for which I want to do the running mean over the third dimension (273 days) for every 4 days.
Any help would be appreciated.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-10-22
Try something like this
M = rand(21, 41, 273);
M_new = movmean(M, [0 3], 3, 'Endpoints', 'discard');
M_new = M_new(:,:,1:4:end);
  5 个评论
Ameer Hamza
Ameer Hamza 2020-10-25
Yes, It means that it takes data from the current value and the next three values.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by