You have a list where you are adding an element to one end and then taking
away an element from the other end.
Hold the sum in a varialble $sum
iterate 1 through 10 adding each element to $sum.
$avg = $sum/10;
Then iterate through until last element is reached
$sum = $sum - $first_element + $new_element;
$avg = $sum/10;
$list = $old_list with first element removed and new element added
Take a look at the "list" processing push, pop and shift, unshift...
-jim ryan
----- Original Message -----
From: "Yacketta, Ronald" <[EMAIL PROTECTED]>
To: "Beginners (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, August 20, 2001 12:21 PM
Subject: assistance needed with data gathering/manipulation
> Folks,
>
> I have a series of ~ 350 data points, I have been asked to get a running
> average of each data
> point.
>
> IE:
>
> data points 1 - 20
>
> 1: 30
> 2: 23
> 3: 1
> 4: 23
> 5: 34
> 6: 56
> 7: 85
> 9: 32
> 10: 89
> 11: 23
> 12: 34
> 13: 19
> 14: 94
> 15: 11
> 16: 19
> 17: 54
> 18: 23
> 19: 87
> 20 49
>
>
> avg1 = (value1 + values2..11) / 10
> avg2 = (value2 + values3..12) / 10
> avg3 = (value3 + values4..13) / 10
>
> the math is the easy part, how would I go about cleanly and efficiently
> running through a has and doing the above?
>
> -Ron
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]