|
From: <pl...@pi...> - 2007-10-22 14:26:23
|
Delta y / Delta x =3D y(row+1)-y(row)/(x(row+1)-x(row)).
sorry I did reply to this one but it went to Levente only not the list.
this sort of trivial task lends itself nicely to the new assign feature =
=
(only in CVS AFAIK) and is exactly the sort of thing I had in mind when =
I =
requested it.
check out the syntax since it is still being developed and may change.
It does not enable you to look ahead or backwards in the data but settin=
g =
a variables like last_x last_y and diffing to the previous point rather =
=
than the next will do this nicely.
This can be done inline in the plot command or via a function call in th=
e =
plot command , that keeps the plot line less cluttered.
Here's two examples: sample max x and y values in plot range and =
trapezoidal integration area under graph. Again check syntax since I thi=
nk =
it has changed since I built this CVS snapshot.
xmax=3D0;ymax=3D0;
max(x,y)=3Dassign("ymax",(ymax<y)?y+0. * assign("xmax",x):ymax );
started=3D0;
add_aug(x,y)=3Dassign("area",(started>0)?\
area + (x-prev_x)*(y+prev_y)/2.0 =
=
+ 0.0*(assign("prev_x",x) \
+assign("prev_y",y) ) \
: 0.0*( assign("started",1) =
+ assign("prev_x",x) + assign("prev_y",y) ) \
) ;
this using clause is in my plot command:
using 1:(add_aug( ($1),($2) ))
HTH, Peter.
|