# XlXtrFun™ Extra Functions for Microsoft Excel

#### Three Dimensional Interpolate and Extrapolate Functions; Two Dimensional Interpolate, Extrapolate, Cubic Spline, Polynomial Curve Fitting, Line Intersections, Minima, Maxima, First Derivative, Second Derivative, and other functions.

XlXtrFun.xll is a collection of functions which extends the capabilities of Microsoft Excel; developed primarily to facilitate, interpolation of 2-dimensional and 3-dimensional data, and simplify 2-variable curve fitting. XlXtrFun has been used for years by engineering and research and development personnel on every continent who need to interpolate, extrapolate, and curve fit data rapidly, reliably, and with a virtually non-existent learning curve.
If you work with real-life data and want to interpolate, extrapolate, or curve fit, then you will find these functions very useful.

"There is a great satisfaction in building good tools for other people to use."
Freeman Dyson (b. 1923); British-born U.S. physicist, author.

From a user in Minano, Italy: "Your functions have become very popular in the last two or three years, and it would be tough to abandon them." Using Spline(), Interpolate(), Intersect(), dYdX(), and ddYdX() functions. Example of the use of Spline(), Interp(), and Interpolate() functions.

## KEY BENEFITS

• Fast, reliable interpolated and extrapolated values in two and three dimensions.
• Three dimensional interpolation and extrapolation using either a set of (x, y, z) points, or matrix of evenly spaced z values.
• If the default method of interpolation and extrapolation is unsuitable, it can be controlled using function arguments which can be cell references. The interpolation and extrapolation method can therefore be easily changed and results can be viewed instantly.
• Polynomial curve fit using the least squares method (up to about order 49) without building elaborate matrices. Order of fit is a function argument which can also be a cell reference. Thus the order of fit can be changed by changing the value in a single cell, so the suitability of fit can be seen instantly.
• Find interpolated or extrapolated intersection of two curves defined by two sets of (x, y) points.
• Find the smoothed curve (constant first derivative) minimum and maximum values of functions defined by a set of (x, y) points.

XlXtrFun has been used for years by engineering and research and development personnel in Europe, South America, and North America who need to interpolate, extrapolate, and curve fit data rapidly, reliably, and with a virtually non-existent learning curve. As the Spline() function example above shows, you define your curve in the first two function arguments by giving it some x's and an equal number of y's. The next argument is the x for which you want the interpolated value, and the function returns the y at that x. We can't imagine an easier way to do things.

The functions also allow for overriding the various default methods of the functions by specifying values for the optional arguments.

Most functions also have exported versions for use by Visual Basic for Applications within the Excel Visual Basic programming environment. Exported versions are also available for "pure" Visual Basic, C, C++, FORTRAN, etc.

## LIST OF FUNCTIONS

### 1D Numerical Functions

LookupClosestValue
Returns the element in an array which is closest to a given value
IndexOfClosestValue
Returns the 1-based index of the element in an array which is closest to a given value

### 2D Numerical Functions

LookupClosestValue2D
Returns the element in a 2-D array which is closest to two given values
Pfit
Returns the Y which lies on the polynomial line fit by the least squares method
PfitData
Returns the coefficients and statistics for the polynomial line fit by the least squares method
Spline
Returns the Y which lies on the cubic (or natural) spline curve at the given X
Interpolate
Returns the Y which lies on an interpolated curve at the given X
Interp
Returns the Y which lies on an interpolated curve at the given X using the defaults of Interpolate
XatY
Returns the X value at the Max. (Peak),. Min (Valley), or Given Y of an interpolated curve
Intersect
Returns the X value at the intersection of two lines defined by arrays of points
ddydx
Returns the second derivative of the interpolated curve at the given X using the defaults of Interpolate
dydx
Returns the first derivative of the interpolated curve at the given X using the defaults of Interpolate

### 3D Numerical Functions

Interp3D
Returns an interpolated Z for known X's, known Y's, known Z's, and a given X and Y using the defaults of Interpolate
InterpMatrix
Given an X, Y, Z matrix like an efficiency hill curve matrix, interpolates or extrapolates a Z using the defaults of Interpolate

Note: 3-D Interpolation from ordered input data is part of XlXtrFun and is what the previous two functions do. Surface Generation from Scattered Input Data is now released and included in the zip file. Feel free to email me with any questions regarding using these routines.

### Low Level I/O Functions

InputByte
Inputs a byte from a given I/O port
OutputByte
Outputs a byte to a given I/O port

### EXPORTED FUNCTIONS

Most functions also have "exported" versions which can be called from other programs written in Visual Basic, Visual Basic for Applications, C, C++, Fortran, etc.

## SYSTEM REQUIREMENTS

Computer:
486DX PC or above.
Memory:
Sufficient for Windows.
Disk Space:
0.5 MB
Operating System:
Windows 95, 98, Me, NT 3.51, NT 4.0, 2000, XP.
Other Software:
Microsoft Excel for Windows 95/97/2000/XP. To use exported functions only, Microsoft Excel is not required.

### INSTALLATION

Click here for installation instructions that will open in a new window. This HTML document is also included in the zip file you download, so you really do not need to look at it at this point in time.