Zephyr Scientific Library (zscilib)
Functions
interp.c File Reference
#include <math.h>
#include <errno.h>
#include <zephyr/kernel.h>
#include <zsl/zsl.h>
#include <zsl/interp.h>

Go to the source code of this file.

Functions

int zsl_interp_lerp (zsl_real_t v0, zsl_real_t v1, zsl_real_t t, zsl_real_t *v)
 Calculates a number between two numbers using linear interpolation, where 't' is the interpolation factor between 0.0f and 1.0f. More...
 
int zsl_interp_find_x (struct zsl_interp_xy xy[], size_t n, zsl_real_t x, int *idx)
 Uses bisection to search the zsl_interp_xy array for the closest array position to 'x', assigning the matching index value to the 'idx' pointer. The array must be monotonic, but can be either increasing or decreasing between xy[0] and xy[n]. More...
 
int zsl_interp_nn (struct zsl_interp_xy *xy1, struct zsl_interp_xy *xy3, zsl_real_t x2, zsl_real_t *y2)
 Nearest neighbour (AKA 'piecewise constant') interpolation based on zsl_real_ts. More...
 
int zsl_interp_nn_arr (struct zsl_interp_xy xy[], size_t n, zsl_real_t x, zsl_real_t *y)
 Nearest neighbour (AKA 'piecewise constant') interpolation based on an array of zsl_real_ts. More...
 
int zsl_interp_lin_y (struct zsl_interp_xy *xy1, struct zsl_interp_xy *xy3, zsl_real_t x2, zsl_real_t *y2)
 Linear (AKA 'piecewise linear') interpolation for Y between two points, based on zsl_real_ts. More...
 
int zsl_interp_lin_y_arr (struct zsl_interp_xy xy[], size_t n, zsl_real_t x, zsl_real_t *y)
 Linear (AKA 'piecewise linear') interpolation for Y between two points, based on zsl_real_ts. More...
 
int zsl_interp_lin_x (struct zsl_interp_xy *xy1, struct zsl_interp_xy *xy3, zsl_real_t y2, zsl_real_t *x2)
 Linear (AKA 'piecewise linear') interpolation for X between two points, based on zsl_real_ts. More...
 
int zsl_interp_cubic_calc (struct zsl_interp_xyc xyc[], size_t n, zsl_real_t yp1, zsl_real_t ypn)
 Calculates xyc[n].y2 for natural cubic spline interpolation, based on the assigned xyc[n].x and xyc[n].y values. More...
 
int zsl_interp_cubic_arr (struct zsl_interp_xyc xyc[], size_t n, zsl_real_t x, zsl_real_t *y)
 Natural cubic spline interpolation between two points, based on zsl_real_ts. More...