forked from 1chipML/1chipML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoly_interpolation.h
38 lines (31 loc) · 1.13 KB
/
poly_interpolation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* This file is part of the 1chipML library. */
#ifndef _BASE_LIB_
#define _BASE_LIB_
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#endif
/*
* The definition below can take the values "float" or "double"
* and defines the precision of the variables used in the polynomial
* interpolation and extrapolation method.
*/
#define poly_real double
/* Functions are declared below */
/*
* This function implements the polynomial interpolation or extrapolation
* using Neville's algorithm. Polynomial approach is only suitable for small
* amount of measured data.
* Input:
* x_a: Measured x values. Those value has to be ordered.
* y_a: Measured y values pairing with x values.
* n: The number of measured data.
* x: The x value of the data to be interpolated/extrapolated.
* y: Return the y value of the data to be interpolcated/extrapolated.
* error: Return the error estimation.
* Return:
* 0 as success, and -1 as error.
*/
int poly_interpolation(poly_real x_a[], poly_real y_a[], unsigned int n,
poly_real x, poly_real* y, poly_real* error);
/* -- End of file -- */