This lib is considered to be used as a sensor's calibration program. Calibration with Spline Interpolation might be useful in the case that you want some model expressing relationship such like between a value of physical quantity and your sensor's voltage, but you cannot estimate a model such as liner, square, cubic polynomial, or sine curve. This makes (Parametric) Cubic Spline Polynomial Model (Coefficients of the polynomial) from some sample plots(e.g. sets of (value, voltage)). The inverse function (x,y)->(y,x) has been implemented so as to get analog data (not stepping or leveled data).
Fork of TRP105F_Spline by
Diff: CubicSpline.h
- Revision:
- 8:e7d451bb4fd4
- Parent:
- 7:e032ddec6ed5
- Child:
- 9:1903c6f8d5a9
--- a/CubicSpline.h Tue May 24 17:37:27 2016 +0000 +++ b/CubicSpline.h Thu May 26 04:50:45 2016 +0000 @@ -39,8 +39,8 @@ // Destraction ~CubicSpline2d(); // Functions - double getX(); - double getY(); + double getX(double arg_y); + double getY(double arg_x); void calibrateSensor(); void saveSetting(); void saveSetting(const char *filename); @@ -57,10 +57,10 @@ Vxyt* _Sample_Set; double* _C_x[4]; //x = Spline-f(t) = _C_x[0] + _C_x[1]t + _C_x[2]t^2 + _C_x[3]t^3 double* _C_y[4]; //y = Spline-f(t) = _C_y[0] + _C_y[1]t + _C_y[2]t^2 + _C_y[3]t^3 + Vxyt _Last_Point; // // // - Vxyt _LastPoint; // // For calibration // @@ -76,16 +76,16 @@ // // For calculation // - // Fuction to return the value of Cubic polyminal f(t) + // Fuction to return the value of Cubic polynomial f(t) double _cubic_f( const double arg_t, - const double* arg_C[4] + const double arg_C[4] ); - // Function to solve a cubic poliminal + // Function to solve a cubic polinomial // by using Gardano-Tartaglia formula void _solve_cubic_f( std::complex<double>* arg_t, - const double* arg_C[4], + const double arg_C[4], const double arg_ft ); //