how i average n values in array
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
yasmeen hadadd
le 21 Août 2016
Commenté : Walter Roberson
le 21 Août 2016
if i have data a and i want to mean or average every 10 values as 1:10, 2:11, 3:12 and as so on for length of data ?
0 commentaires
Réponse acceptée
Walter Roberson
le 21 Août 2016
mean(reshape(YourData, 10, []))
8 commentaires
Andrei Bobrov
le 21 Août 2016
Hi Walter! Small correcting.
cs = cumsum(YourData(:));
moving_average = (cs(10:end) - [0;cs(1:end-10)])/10;
Plus de réponses (2)
Star Strider
le 21 Août 2016
‘But i need overlap between the values as 1:10 then from 2:11 and so on’
Use a moving average filter:
Heart_pulse_avg = filter(ones(1,10), 10, Heart_pulse);
1 commentaire
Andrei Bobrov
le 21 Août 2016
a - your vector;
out = movsum(a,[0 9],'Endpoints','discard')/10;
0 commentaires
Voir également
Catégories
En savoir plus sur Operators and Elementary Operations 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!