Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
1D Interpolation class

The qlibs::interp1 class provides a simple, consistent interface for a set of one-dimensional interpolators. The class recieves X-Values and Y-Values and the size of this arrays to setup the instance. The user can later pass the X point to interpolate, and the interpolator instance return the estimated Y at the point X using the specified method.

The current supported methods are:

If value is beyond the endpoints, extrapolation is performed using the current method.

Example : Code snippet that demonstrates the spline interpolation .

real_t xdat[] = { 1.0f, 6.0f, 11.0f, 16.0f, 21.0f, 26.0f, 31.0f, 36.0f };
real_t ydat[] = { 59.6870f, 44.5622f, -0.8642f , 0.8725f, -2.3016f, -50.3095f, -54.5966f, 37.9036f };
interp1 interpolator( xdat, ydat );
interpolator.setMethod( INTERP1_SPLINE );
auto ye = interpolator.get( 18.5f ); //interpolated value at 18.5