ocmath_yatasymt

 

Description

Get the value of Y at a horizontal asymptote.

Syntax

int ocmath_yatasymt( UINT nSize, const double * px, const double * py, double * dYAsympt )

Parameters

nSize
[input] size of px, py
px
[input] it contains curve's X coordinate's datas, should be rigid increasing
py
[input] it contains curve's Y coordinate's datas
dYAsympt
[output] the value of Y at a horizontal asymtote

Return

Return OE_NOERROR if success.

Examples

EX1

void ocmath_yatasymt_ex1()
{
    double dYAsympt;
    vector vx, vy;

    //******* Create sample data *****************
    vx.SetSize(13);
    vy.SetSize(13);
    vx[0]=-20;     vy[0]=-3.04762;
    vx[1]=-14;     vy[1]=-3.06667;
    vx[2]=-8;     vy[2]=-3.11111;
    vx[3]=-2;     vy[3]=-3.33333;
    vx[4]=-1;     vy[4]=-3.5;
    vx[5]=0;     vy[5]=-4;
    vx[6]=1;     vy[6]=NANUM;
    vx[7]=2;     vy[7]=-2;
    vx[8]=3;     vy[8]=-2.5;
    vx[9]=4;     vy[9]=-2.66667;
    vx[10]=10;     vy[10]=-2.88889;
    vx[11]=16;     vy[11]=-2.93333;
    vx[12]=22;     vy[12]=-2.95238;
    //******** End of Sample Data Creation *******            
    
    int nRet = ocmath_yatasymt(vx.GetSize(), vx, vy, &dYAsympt);
    if(nRet != OE_NOERROR)
    {
        printf("Error in computing the horizontal asymptote of X\n.")
    }
    printf("The value of Y at the horizontal asymptote of X = %f\n", dYAsympt);
}

Remark

The function used for fitting function parameter initialization.

Get the value of Y at a horizontal asymptote. If the asymptote has two branches then Y is defined as Y = (yatxmax+yatxmin)/2 and if the asymptote has a single branch then Y is defined as either yatxmax or yatxmin depending on where the slope of the curve is closest to zero.

See Also

ocmath_xatasymt

Header to Include

origin.h

Reference