how to do running mean?

3 vues (au cours des 30 derniers jours)
Lilya
Lilya le 22 Oct 2020
Commenté : Lilya le 25 Oct 2020
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.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 22 Oct 2020
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 commentaires
Ameer Hamza
Ameer Hamza le 25 Oct 2020
Yes, It means that it takes data from the current value and the next three values.
Lilya
Lilya le 25 Oct 2020
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by