Fitting an Akima Spline curve

292 Views Asked by At

I'm trying to fit an Akima Spline curve using the same method as this tool: https://www.mycurvefit.com/share/4ab90a5f-af5e-435e-9ce4-652c95c3d9a7

This curve gives me the exact shape I'm after for my case (the curve line peaking at X = 30M, the highest point from the sample data)

But when I try to calculate this using an Akima library function from MathNet, it plots this: https://www.mycurvefit.com/share/faec5545-abf1-4768-b180-3e615dc60e3a

Which isn't the same curve at all, I get a curve which peaks around X = 26M, and looks much more like a Natural Spline.

By looking at the curve, any ideas as to what the library might be doing differently behind the scenes?

Not a code issue, but here's the function I'm using for reference:

var x = new List<double> { 0, 15000000, 30000000, 40000000, 60000000 };
var y = new List<double> { 0, 93279805, 108560423, 105689254, 90130257 };

var interpolation = MathNet.Numerics.Interpolation.CubicSpline.InterpolateAkima(x.ToArray(), y.ToArray());

for (int i=1; i<=52; i++)
{
    var cY = interpolation.Interpolate((60000000d/52d)*i);
}

What is the reason the Akima's look so different? (especially in terms of peak)