How to draw a curve through every point.

83 Views Asked by At

I have x,y coordinates. They are arranged at fixed intervals of 1 unit along the x axis. The Y values are arbitrary. I want to draw smooth curvy line that passes through all of them. Or rather, I want a formula to find the y for any value of x for the hypothetical line.

2

There are 2 best solutions below

0
On

Here are a few methods you can use:

  1. Simply interpolate them using a bunch of quadratics. The resulting curve will have discontinuous 2nd derivative.

  2. Lagrange polynomial

  3. Discrete Fourier transform

0
On

Cubic (or other degree) splines. That way you can make the curve as smooth as you want.