# POLYGRAPH

## Purpose:

Evaluates polynomial coefficients, such as those generated by POLYFIT, at the specified X values.

## Syntax:

POLYGRAPH(coef, xdata, xy, form)

coef

-

A series, the polynomial coefficients.

xdata

-

A series, the X values used to evaluate the polynomial.

xy

-

Optional. An integer, the series output form:

 0: output interval series, regularly spaced X data (default) 1: output XY series, X data irregularly spaced

form

-

Optional. An integer, the polynomial coefficient form:

 0: ascending powers, lowest degree to highest (default) 1: decreasing powers, highest degree to lowest

## Returns:

A series, the value of the polynomial for the input xdata.

## Example:

W1: gline(100,.01,1.0,1.0)^3

W2: polyfit(W1, 3)

returns a 4 point series with values {1,3,3,1} as the resulting 3rd order coefficients

W3: polygraph(W2, xvals(w1))

graphs the fit.

## Remarks:

Given the coefficient series a of an Nth order POLYFIT, if y[j] is the jth point of the series generated by POLYGRAPH, then:

where a[k] is the kth point in the coefficient series, and x[j] is the jth point of the x series.

If form is 1, then:

If xy is 0, the result is an interval series where the XOFFSET is set to the first point of the X series and the DELTAX is set to the difference of the first two points in the X series.

If xy is 1, the result is an XY series where the X values are the same as xdata.

POLYGRAPH requires a series for the X data and always returns a series. See POLYVAL for a similar routine that accepts a scalar input and returns a scalar.

See POLYFIT to perform a least squares fit to generate polynomial coefficients.