plpolv

calculate y-value for an x-value of a polynomial

parametertypeunitsdescription
xfloatuux-value for which polynomial value is to be returned
returns:float

Description

plpolv returns the value at x of the polynomial calculated earlier by plpoly/plpolf.

Examples

The following program plot a polynomial and then instructs you how to interpolate on it by hand. The program itself interpolates by using:
#include <simplot.h>
int main() {
   float x[]={1,2,3,4};
   float y[]={0,1,4,9};
   float xmin=0,xmax=5,ymin=0,ymax=10,xpol=3.5,ypol;

   plinit(PS,"plpolv",A4,50,50,"","");
   plset(XGRID,TRUE);
   plaxes(xmin,ymin,xmax,ymax,100,60,"X","Y","Polynomial interpolation");
   plframe(5,3);
   plpline(x,y,4,"X",UP);
   plclip(xmin,ymin,xmax,ymax);
   plpoly(x,y,4,2,xmin,xmax,DOWN);
   ypol=plpolv(xpol);
   plot(xpol,ymin,UP);
   plformat(0,0,"X");
   plarrow(0,ypol,5,10,30,FALSE,FALSE,TRUE,FALSE,"");
   plot(xpol,ypol,UP);
   plformat(0,0,"X");
   plarrow(-xpol,0,5,10,30,FALSE,FALSE,TRUE,FALSE,"");
   plunclip();
   plset(PENDIA,2);
   plpscomt("start plframe");
   exit(0);
}

plpolv