I have some time series data that I would like to approximate with a twice-differentiable function. Each time series has ~10,000 datapoints, so I definitely do not want a function that passes through all these points. This rules out using InterpolatingFunction.

I have no mathematical model for these data at all, otherwise I would use LinearModelFit or NonlinearModelFit for this.

The only solution I can think of would be to perform some type of smoothing on the data (LowpassFilter?), and then somehow generate an approximating function object from the smoothed data.

Is there a built-in function for doing this sort of thing? (It's not that I think there's anything wrong with the recipe outlined above, but as a rule I prefer to use built-in methods over home-spun ones whenever possible.)

  • 1
    $\begingroup$ What about splines? They should work pretty well. $\endgroup$ Commented Jun 5, 2015 at 20:27
  • 2
    $\begingroup$ did you mean to say you "do not want to pass though" all the points? $\endgroup$
    – george2079
    Commented Jun 5, 2015 at 20:36
  • $\begingroup$ @george2079: thanks! I just edited the post to add the missing "not". $\endgroup$
    – kjo
    Commented Jun 5, 2015 at 21:12
  • 1
    $\begingroup$ Here is a method I have used that smoothes and uses interpolation at the same time:mathematica.stackexchange.com/a/72037/12558 $\endgroup$
    – Hugh
    Commented Jun 5, 2015 at 22:27
  • 1
    $\begingroup$ If your datapoints are equally-spaced you can use the Savitzky-Golay filter. $\endgroup$ Commented Jun 8, 2015 at 13:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.