[SOLVED] php moving average
Hello,
Suppose I have the following array to generate a table. How can I perform calculation to get the moving average of last 10 collections on the 11th row (not the 10th)? I managed to pull the index value for each array but have no clue how to go further. Also, any suggestions to improve the code is most appreciated. PHP Code:
|
This can't be difficult, not even in PHP, but you should clarify your question. Now it is fully incomprehensible.
Quote:
Quote:
Please make clear what your intention is, give values and examples of what you want to calculate. When that is fully clear, translating it into PHP is a breeze. jlinkels |
Quote:
Here's a sample table of what i'm expecting to achieve. Code:
<table border="1"> |
This should come close. Bear in mind that with a moving average you'll always having difficulties at the start and end of the data range as a moving average assumes a continuous data stream.
PHP Code:
|
Thanks jlinkels :)
Now I'll have to try and figure out how to use this method to generate the moving average for a postgresql query. |
All times are GMT -5. The time now is 06:51 PM. |