c - How to take a moving mean of an array -


Can someone help me with this problem because I have spent time without doing any work. I have data in an array of shapes which say 3O

  1. I want to take the first five elements of the array, they get the value. Store the value in another array
  2. Again, by looking at the mean value of 5 elements, go to the second element of the array. Stop the value in the array as above.
  3. Then pay attention to the third element, do the same thing over the last element which is 30 in this case.

      float tabdata [] = {1,2,3,4, ..., 30}; Four * store; Float yoga; For (Int j = 0; j & lt; tab data [30-1]; J ++) Yoga + taborda [ja]; If (J = 5) {float means = sum / 5; Shop [j] = mean; Yoga = 0; For (i = j; i & gt; tab data [30-1]; i ++) yoga + = tabata [i];  

If (j = 5) ------- .... Need help completing this loop. Just add 1/5 in the next step and subtract 1/5 in the current window in each stage.

The only thing you need to worry about is the floating point exact.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -