Forum archive 2000-2006

Michael Gage - plot_list

Michael Gage - plot_list

by Arnold Pizer -
Number of replies: 0
inactiveTopicplot_list topic started 8/28/2001; 8:31:13 PM
last post 8/28/2001; 8:31:13 PM
userMichael Gage - plot_list  blueArrow
8/28/2001; 8:31:13 PM (reads: 1879, responses: 0)

plot_list

Description
Plots a piecewise linear non-parametric curve through a sequence of points.

Syntax


$fun = plot_list([x0,y0,x1,y1,...]);

$fun = plot_list([(x0,y0),(x1,y1),...]);

$fun = plot_list(\@x_y_array);



$fun = plot_list([x0,x1,x2...], [y0,y1,y2,...]);

$fun = plot_list(\@xarray,\@yarray);

Params

Arguments are either a reference to a single array of (x,y) pairs, or references to two pairs of arrays, containing the x values and y values respectively. The x values should be strictly increasing.

Returns

A reference to a function subroutine which accepts a single x argument and returns a y value. The domain of the function is the closed interval between the lowest and highest x values

Examples

$fun = plot_list([(0,1), (1,4), (2,0) ]); # stores a reference to a piecewise linear function in $fun.
$y = &$fun(1.5); # calculates the value of the interpolating piecewise linear function at x=1.5

Notes

This macro is defined in PGnumericalmacros.pl

 

<| Post or View Comments |>