Forum

A mean every x new values

Hi all,

i have to calculate the mean every 10 new values,

so for example imagine that will be 20 values 1,2,3,4,5,6,7,8,910,11,12,13,14,15,16,17,18,19,20

if use the queque and set a frame count of 10 and put a mean after it, i will calculate 1,2,3,4,5,6,7,8,9,10 --> mean , after
2,3,4,5,6,7,8,9,10,11 --> mean
3,4,5,6,7,8,9,10,11,12 --> mean
and so on…

but i want instead
1,2,3,4,5,6,7,8,9,10 --> mean
11,12,13,14,15,16,17,18,19,20 --> mean

how can i have this?
thx

what about + (Value Spectral) with a binsize of 10 and then divide by 10?

hi Kalle,

thx but i’m not sure because i don’t have the spread of value ready,
it’s arduino that is sending about 30 values every second,
and so i want to do a mean for every block of 10 values and never use the same value 2 times for the means.

i need some sort of queue that could do this loop:

1 wait untill it collect new 10 values
2 do the mean of these 10 values
3 delete all values.

like sis?.. no text …

mean1-10.v4p (5.6 kB)

Why not let the Arduino do the smoothing for you?