Curve_y

 

Description

Get Y value of Curve at specified index.

Syntax

double Curve_y( curvebase * pcrvData, int nIndex )

Parameters

pcrvData
[input] Pointer to Curve
nIndex
[input] Zero based index

Return

For given Curve returns value of Y at specified value of nIndex.

Examples

EX1

// This is a self contained sample program for the function Curve_y, 
// Its sample data is created at the beginning of the program. 
// To run the program, enter the following command in the Script window:
//   Curve_y_ex1
// It returns like the following three lines:
//   Find Y at Row#3 ==> FOUND: 8
void Curve_y_ex1()
{
    double dYatI;
    Worksheet wks;
    wks.Create();
    Dataset myXDs(wks,0);
    Dataset myYDs(wks,1);
    
    //******* Create sample data *****************
    myXDs.SetSize(4);
    myYDs.SetSize(4);
    myXDs[0]=1;    myYDs[0]=2;
    myXDs[1]=2;    myYDs[1]=4;
    myXDs[2]=4;    myYDs[2]=8;
    myXDs[3]=8;    myYDs[3]=16;
    //******** End of Sample Data Creation *******
    
    Curve crvData( myXDs, myYDs );    // Create Curve object

    int nIndex=2;       // 0-based index
    dYatI = Curve_y(&crvData,nIndex);    // Demonstration of Curve_y
    if(dYatI!=NANUM)
        printf( "Find Y at Row#%d ==> FOUND: %g\n",nIndex+1,dYatI); // Row#=nIndex+1
    else 
        printf( "Find Y at Row#%d ==> NOT FOUND\n",nIndex+1); // Row#=nIndex+1
}

Remark

The function used for fitting function parameter initialization.

See Also

Curve_x

header to Include

origin.h

Reference