This project has moved and is read-only. For the latest updates, please go here.

Linear Interpolation

Feb 13, 2015 at 6:30 PM
I am using the linear interpolation in Math.Net 3.5

var method = Interpolation.Linear(x,y)
var y2 = method.Interpolate(x2)

Is there a way to interpolate a list of x values?

var yValues = method.Interpolate(xValues)
Feb 13, 2015 at 6:46 PM
If the "list of x values" is a Vector<T> then why not use
Vector<T>.Map(Func<T, TU> f, Zeros zeros)
which will return a new Vector<TU> of the "y values"

If x values is just a List<T> or an array then use Linq:
var yValues = xValues.Select(method.Interpolate);
to get an IEnumberable<T>
and add .ToList() or .ToArray() to get other result stuctures.