I have a linear timeseries which "looks" like a pseduo-sinosoidal function (\Inf -smooth, more or less regularly shaped peaks, gradual change in aplitudes, etc). I want to interpolate this function with cubic B-splines (please do not "XY" me here, this is the only choice I have because <reasons>; assume it's my only drawing primitive).

How can I choose the control points of the spline based only on the timeseries so that it "looks good"? By this I mean - for starters - there is a better an approximation than simple linear interpolation would give (make this formal with least square error if you like). It seems this should definitely be possible.

(So far, I've had the self-imposed constraint/default of one knot per sample.)

I've tried many things geometrically - points some configurable distance outward along the tangent to the curve, points along the linear segments of adjacent points, etc, etc. No matter what I do, the result seems "crazy" - weird looping or distortions or it's not a function anymore or just plain "not how you'd draw it". (Perhaps some kind of coordinate transform is required?)

I can make it seem reasonable in photoshop/gimp after manually for a single instance of the function by adjusting the points by hand, but I have /no idea what I did to make it that way/, and I can't figure out what makes it or breaks it - I haven't been able to write down a rule.


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.