# Re: Creating a bezier curve with defined data-set

From: Steve Schafer <steve@fenestra.com>
Date: Wed, 09 May 2007 21:30:50 -0400
To: <www-svg@w3.org>
Message-ID: <etr443pb273fcf13focsn6ddm0j135uo6i@4ax.com>
```
On Wed, 9 May 2007 16:28:07 -0400, you wrote:

>I'm trying to create a smooth production decline curve with a dataset of
>20 points. I explored the Bezier quadratic and cubic curves available
>under SVG but it looks like they need control points outside my dataset
>to function. Looks like I would need control points between each of the
>20 points to get this to work. I would appreciate any ideas to generate
>control points or even better, ideas on generating a smooth curve
>without generating control points.

Fitting a curve to data does _not_ involve generating a curve that goes
through every point. An equation for the curve should be based on a
model that purports to explain the observed data (exponential,
polynomial, etc.). Any of a number of curve-fitting algorithms may be
used to generate that equation (you can do it in Excel, for example).
But generating a smooth curve that just happens to look good is
meaningless; unless there is a model behind the curve, the curve itself
adds no information to the graph. Production decline curves (oil?) are
outside of my area of expertise, but I'm guessing that a first-order
approximation would be exponential, and a second-order approximation
would be a sum of exponentials (sometimes called a "long-tailed"
exponential).

Once you have the equation for the curve, you can either plot it
directly (lots of points connected by straight-line segments) or apply a
standard transformation that will take the equation and endpoints as
input and give you a "best fit" approximation consisting of one or more
Bézier curve segments. It's that transformation process that will give
you the control points needed to specify the Bézier curve(s).

The bottom line is that all of this process is pretty much outside the
scope of SVG; you need to do this _before_ you can generate the SVG that
will produce the actual image. Bézier curves are an excellent
_representation_ of the result of curve-fitting, but they're generally
not too useful during the _process_ of fitting a curve to empirical
data, as they have too many degrees of freedom (and, of course, they
rarely correspond to any theoretical model of the data).

Steve Schafer
Fenestra Technologies Corp.
http://www.fenestra.com/
```
Received on Thursday, 10 May 2007 01:31:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:10 UTC