Re: Moving average smoothing of curves in graphs



Le mercredi 15 février 2006 à 15:37 -0500, Morten Welinder a écrit : 
OK, I see, it is quite easy to implement. Just two more questions:
- should I use the same x_i values when evaluating the smoothed ones (I
guess the answer is yes).

You can use any x value for m(x), including the x_i values and anything
in between.  In fact there is no need to you splines for interpolation.

I don't use splines for smoothed curves, only for regressions.

- how should I compute a default value for h ((last_x - first_x) / 10 ?)

For the "line" case, use (say) 10 * the _step_ you chose between x values.
For the "xy" case, use something like 10 * (last_x - first_x) / N.

The smoothing code does not know what type of plot it is working with
(it can of course know the name of the plot type and if the x-axis is
discrete or not). It just get two arrays filled with the x and y values.
In the xy case, we also might have disordered x values, which makes
things more difficult. For the moving average smoothing, I duplicated xl
behavior it that case.
I feel I'll use 10 * (last_x - first_x) / (N - 1) for all cases and skip
invalid values where N is the number of original data points.

Jean




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