3.5.1.1.6 DerivativeXY

Description

This functions returns the derivative of the curve whose XY coordinates denoted by vector vx and vy. No smoothing is performed in this function. Derivative is computed by taking the average slopes from the previous and next two data points except at the ends where only one slope is used. This algorithm is applied recursively for each order n.

Syntax

vector DerivativeXY(vector vx, vector vy[, int n])

Parameters

vx

The x data vector used to calculate derivative.

vy

The y data vector used to calculate derivative.

n

The order of derivative. Default value is 1.

Return

Return the nth order of derivatives of specified curve (vx, vy).

Example

The following example calculates the first derivative from sample data HiddenPeaks.dat and creates a stacked line plot.

newbook;
string fn$ = system.path.program$ + "Samples\Spectroscopy\HiddenPeaks.dat";
impasc fname:=fn$;
col(3)=DerivativeXY(col(1),col(2),1);
col(3)[L]$ = "1st Deriv";
plotstack iy:=(1,2:3) plottype:=line link:=1 xlink:=1;
range l1 = 1!;
l1.x.from = 0; 
l1.x.to = 10;

See Also

Derivative(vd[,n])