I came across Math.NET when searching for a simple linear interpolator in c#. It seems an elegant and useful solution, I would like to use it, but have a small problem, perhaps somebody can help.
I have an application in which I need to do 1-d interpolation with an unknown number of points, between 3 and 7, the number will vary.
The default method (barycentric) seems to fail with only 3 points.
double[ values = new double[ { 6.0, 12.0, 16.0 };
double[ points = new double[ { 1.0, 2.0, 3.0 };
IInterpolationMethod method = Interpolation.Create(points,values); // t, x);
IInterpolationMethod method2 = Interpolation.CreatePolynomial(points, values);
double a = method.Interpolate(2.5);
double b = method2.Interpolate(2.5);
a gives NaN, b gives 14.25
CreatePolynomial works, but I would prefer linear interpolation between the closest points, to return value of 14.0. I do not see an obvious linear interpolation example. Can anyone advise me as to the best approach for using Math.Net with only 3 values, advise as to what would come closest to linear interpolation, and point me to a relatively simple explanation of the various interpolants that are supported.
Thanks in advance.
Richard Males
Cincinnati, OH USA