Re: Moving average smoothing of curves in graphs



Original data: f(x_i) = y_i

            sum_i (f(x_i) * w_i(x))
m(x) = ---------------------------                                     (*)
                 sum_i w_i(x)

             /       0                       , if x_i > x
w_i(x) = {
             \       2^((x_i-x)/h)       , if x_i <= x

The "0" part ensures that as you draw the graph left-to-right, only points
to the left of where you are affect m(x).

Notice that for d>=0:

    w_i(x+d) = 2^(-d/h) * w_i(x)

which makes it easy to compute (*) because it stays constant between
the x_i's and you can easily compute the new nominator and denominator
from the old ones and the new data point.

M.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]