# NDK_INTERPOLATE

 int __stdcall NDK_INTERPOLATE ( double * X, size_t Nx, double * Y, size_t Ny, double * XT, size_t Nxt, WORD nMethod, BOOL extrapolate, double * YVals, size_t Nyvals )

estimate the value of the function represented by (x,y) data set at an intermediate x-value.

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
 [in] X is the x-component of the input data table (a one dimensional array) [in] Nx is the number of elements in X [in] Y is the y-component of the input data table (a one dimensional array) [in] Ny is the number of elements in Y [in] XT is the desired x-value(s) to interpolate for (a single value or a one dimensional array). [in] Nxt is the number of elements in XT [in] nMethod is the interpolation method (1=Forward Flat, 2=Backward Flat, 3=Linear, 4=Cubic Spline). Forward Flat Backward Flat Linear Cubic Spline [in] extrapolate sets whether or not to allow extrapolation (1=Yes, 0=No). If missing, the default is to not allow extrapolation [out] YVals is the output buffer to store the interpolated values [in] Nyvals is the number of elements in YVals (must equal to Nxt).
Remarks
1. The X and Y array sizes must be identical.
2. The X-array and Y-array both consist of numerical values. Dates in Excel are internally represented by numbers.
3. The values in the X-array can be unsorted and may have duplicate values.
4. In the case where X has duplicate values, INTERPOLATE will replace those duplicate values with a single entry, setting the corresponding y-value equal to the average.
5. The X and/or Y arrays may have missing values (#N/A). In this case, INTERPOLATE will remove those entries.
6. For cubic spline interpolation, we construct a set of natural cubic splines that are twice continuously differentiable functions to yield the least oscillation about the function f which is found by interpolation in Excel.
Requirements
 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_INTERPOLATE ( double[] pXData, UIntPtr nXSize, double[] pYData, UIntPtr nYSize, double[] pXTargets, UIntPtr nXTargetSize, short nMethod, bool allowExtrp, double[] pYTargets, UIntPtr nYTargetSize )

estimate the value of the function represented by (x,y) data set at an intermediate x-value.

Return Value

a value from NDK_RETCODE enumeration for the status of the call.

 NDK_SUCCESS operation successful Error Error Code
Parameters
 [in] pXData is the x-component of the input data table (a one dimensional array) [in] nXSize is the number of elements in pXData [in] pYData is the y-component of the input data table (a one dimensional array) [in] nYSize is the number of elements in pYData [in] pXTargets is the desired x-value(s) to interpolate for (a single value or a one dimensional array). [in] nXTargetSize is the number of elements in pXTargets [in] nMethod is the interpolation method (1=Forward Flat, 2=Backward Flat, 3=Linear, 4=Cubic Spline). Forward Flat Backward Flat Linear Cubic Spline [in] allowExtrp sets whether or not to allow extrapolation (1=Yes, 0=No). If missing, the default is to not allow extrapolation [out] pYTargets is the output buffer to store the interpolated values [in] nYTargetSize is the number of elements in YVals (must equal to Nxt).
Remarks
1. The pXData and pYData array sizes must be identical.
2. The X-array and Y-array both consist of numerical values. Dates in Excel are internally represented by numbers.
3. The values in the X-array can be unsorted and may have duplicate values.
4. In the case where X has duplicate values, INTERPOLATE will replace those duplicate values with a single entry, setting the corresponding y-value equal to the average.
5. The X and/or Y arrays may have missing values (#N/A). In this case, INTERPOLATE will remove those entries.
6. For cubic spline interpolation, we construct a set of natural cubic splines that are twice continuously differentiable functions to yield the least oscillation about the function f which is found by interpolation in Excel.
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI SFSDK Public Static NumXLAPI.DLL
Examples

References
* Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
* Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
* D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
* Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848