FunctionDiagonal-rational interpolation of X-Y-MZ-table values
Syntax C/C++#include <MFstd.h>
void MF_ratinterpol( fMatrix MZ, fVector X, fVector Y, ui ht, ui len, fVector XTab, fVector YTab, fMatrix MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
C++ VecObj#include <OptiVec.h>
void matrix<T>::ratinterpol( const vector<T>& X, const vector<T>& Y, const vector<T>& XTab, const vector<T>& YTab, const matrix<T>& MZTab, unsigned degX, unsigned degY );
Pascal/Delphiuses MFstd;
procedure MF_ratinterpol( MZ:fMatrix; X, Y:fVector; ht, len:UIntSize; XTab, YTab:fVector; MZTab:fMatrix; httab, lentab, degX, degY:UInt );
DescriptionFor each of the ht * len x / y coordinates defined by X and Y, the corresponding element of MZ is interpolated from the XTab-YTab-MZTab values. XTab and YTab must be ordered (either ascending or descending). All values of XTab as well as of YTab must be distinct; otherwise a division by zero may occur and lead to a program abort. The parameter degX denotes the number of points that will be taken into account for the interpolation in X direction. Similarly, degY denotes the number of points taken into account for the interpolation in Y direction. The diagonal rational interpolation scheme by Stoer and Bulirsch is used. The interpolating function is formed by the quotient of two polynomials, the polynomial in the denominator being of the same order (for even deg) or of an order higher by one (for odd deg) than the polynomial of the numerator.
Diagonal rational interpolation is superior to polynomial interpolation, especially in the presence of poles. It is, however, much slower.
deg must be between 3 and 20. Additionally, degX may not be larger than lentab-1; degY may not be larger than httab-1.
Error handlingA pole (infinity) in the interpolated function is recognized and leads to a SING error with the proposed result being ±HUGE_VAL. (Note: the x-value passed to _matherr is the first element of XTab, if the error occurs while interpolating in X directions, or the first element of YTab, if the error occurs while interpolationg in Y directions). Trying to use too many elements for the interpolation (degX or degY > 20) leads to an error message "Not possible with more than 20 elements" and to a program abort. If degX or degY are < 3, or if degX exceeds lentab-1, or if degY exceeds httab-1, an error message "Invalid parameter(s)" is displayed and the program aborted.
No other errors are detected (you have to take care yourself that the XTab and YTab values are distinct).
Return valuenone
See alsoMF_polyinterpol,   MF_natCubSplineInterpol,   VF_ratinterpol

MatrixLib Table of Contents  OptiVec home