REAL FUNCTION POLY( X, XPTS, YPTS, NDEG )
INTEGER NDEG ! degree to use
REAL X ! X-value to compute Y for
REAL XPTS ( NDEG + 1 ) ! table of X-values to be used
REAL YPTS ( NDEG + 1 ) ! table of Y-values to interpolate from
float POLY( const float *x,
const float *xpts,
const float *ypts,
const int *n ) ;
When interpolating from a large table, it is the responsibility of the caller to pass the portion of the table appropriate for the X at which the interpolation is being evaluated. NOTE: high-order purely polynomial interpolations have stability problems. NDEG <= 5 is recommended. -- CJC
#include "iodecl3.h" if called from C.
X should lie in the domain specified by the array XPTS of X-values so that POLY() is doing interpolation instead of extrapolation.
...
REAL POLY
REAL X, Y
REAL XPT( 100 )
DATA XPT / ... /
REAL YPT( 100 )
DATA YPT / ... /
...
Y = POLY( X, XPT( 16 ), YPT( 16 ), 3 ) ! interpolate Y-values to X
...
...
#include "iodecl3.h"
...
float x, y, xpt[], ypt[] ;
int deg ;
...
y = POLY( &x, &xpt, &ypt, ° ) ;
/* Now y is result of degree-deg polynomial interpolation of curve
determined by xpt[] and ypt[] to x */
...
To: Models-3/EDSS I/O API: The Help Pages