PDA

View Full Version : Cubic Spline Interpolation Guessing the Control Points


luckpp
May 26, 2009, 05:30 AM
Hello,

Given a set of 2D points (located on a 2D graph) I want to guess the spline cubic control points in order to draw a smoother 2D graph.

I will use a set of images in order to show you what I want to do:

Starting from 5 control points ( [0, 0], [25, 50], [50, 25], [75, 75], [100, 100] ) I was able to guess the intermediate points using Cubic Spline Interpolation. Below is the result:


Graph_OK (http://picasaweb.google.com/OrpheussGOD/Diagrams#5340108239482566050)


My problem is when I try to do the reverse operation, namely : starting from a set of 101 known 2D points ([x0, y0] [x1, y1], … [xk, yk], … [x99, y99], [x100, y100]) I want to guess some control points in order to draw a smoother graph than the one resulting from the initial 101 2D points.

In a rough form the graph may look like this:


Graph_NOK (http://picasaweb.google.com/OrpheussGOD/Diagrams#5340108238581848914)


But I want a smoother graph.
I would highly appreciate your help. Any hint on how should I guess the control points and draw a spline curve would be great.

Thank you very much and Best regards,
Lucian Andritoi.

Perito
May 26, 2009, 06:35 AM
I find cubic spline interpolation to be a bit irritating in the same way that you're finding. Often, I'll use Savitzky-Golay convolution to filter equally-spaced points (I don't know if yours are equally spaced on the x-axis or not).

Savitzky-Golay smoothing filter (http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter)

Some of the equations given in SG's paper are incorrect and are corrected in subsequent papers by SG and others.