curve_derivative

Description

Simple derivative calculations without smoothing. Missing values are ignored.
Derivative is computed by taking the average of the two data points slopes from the previous and next data points.

Syntax

bool curve_derivative( curvebase & cuv )

Parameters

cuv
[modify] curve of Y data, result of derivatives are put back to replace original data

Return

FALSE if not enough data to compute derivatives, else return TRUE

Examples

EX1

void curve_derivative_ex1()
{
    vector vx, vy;
    vx.Data(-4.5, 6.7, 0.23);
    vy.Data(1, vx.GetSize());
    Curve crv(vx, vy);
    vector vderiv;
    vderiv = vy;
    if(curve_derivative(crv))
    {
        Worksheet wks;
        wks.Create();
        wks.SetSize(-1, 3);
        
        Dataset da(wks, 0);    
        da = vx;
        
        Dataset db(wks, 1);    
        db = vy;
        
        Dataset dc(wks, 2);    
        vderiv = crv;
        dc = vderiv;
    }
}

Remark

See Also

Curve_derivative

header to Include

origin.h

Reference