Skip to content

static (no heap) linear interpolation for personal usage

Notifications You must be signed in to change notification settings

ihtamnetu/linear-interpolation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

linear-interpolation

static (no heap) linear interpolation for personal usage

  1. #define the number of points of your dataset #define N_POINTS 64

image

  1. create 2 float arrays x[N_POINTS], y[N_POINTS] filled with your dataset

image

  1. create 1 float array for cache: cache[(N_POINTS-1)*2]
  2. create 1 bool (uint8_t) array for cache: bcache[N_POINTS-1]

image

  1. create interp_t variable: interp_t interp;

image

  1. initialize interp_t interp with interp_init(...): interp_init(interp, x, y, cache, bcache, n_points)

image

  1. calculate wanted y(x) with interp_calc(interp_t *obj, float x, float *y_calc): interp_calc(interp, x, &y_calc); // calculated value will be stored in y_calc

image

  1. ???
  2. feel free to rewrite the code if needed

About

static (no heap) linear interpolation for personal usage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages