I have a situation where I need to process 5000 samples from a device in every 0.5 sec.
Lets say the window size is 100, then there would be 50 points resulting fro
static int[] myIntArray = new int[16];
public static double maf(double number)
{
double avgnumber=0;
for(int i=0; i<15; i++)
{
myIntArray[i] = myIntArray[i+1];
}
myIntArray[15]= (int) number;
/* Doing Average */
for(int i=0; i<16; i++)
{
avgnumber=avgnumber+ myIntArray[i];
}
return avgnumber/16;
}
this algorithm can also be called as Moving Average Filter which is working well for me ... i implemented this algo in my graph project!