yatxmax

 

Description

Get the value of Y at the maximum X value of a curve.

Syntax

double yatxmax( Curve & crv )

Parameters

crv
[input] Origin C Curve object; The given X dataset should be monotonic.

Return

Returns the value of Y at the maximum X value of a curve.

Examples

EX1

// This is a self contained sample program for the function yatxmax, 
// Its sample data is created at the beginning of the program. 
// To run the program, enter the following command in the Script window:
//   yatxmax_ex1
// This will return the result like following:
//   Y(Data2_B) at Maximum of X(Data2_A) = 0.44514

void yatxmax_ex1()
{
    double dYatXmax;
    
    Worksheet wks;
    wks.Create();
    Dataset myXDs(wks,0);   // X dataset should be monotonic
    String strXName = myXDs.GetName();
    Dataset myYDs(wks,1);
    String strYName = myYDs.GetName();
    
    //******* Create sample data *****************
    myXDs.SetSize(8);
    myYDs.SetSize(8);
    myXDs[0]=1;    myYDs[0]=0.3; 
    myXDs[1]=2;    myYDs[1]=0.097; 
    myXDs[2]=3;    myYDs[2]=0.41256;
    myXDs[3]=4;    myYDs[3]=0.24909;
    myXDs[4]=5;    myYDs[4]=0.47304;
    myXDs[5]=6;    myYDs[5]=0.2476;
    myXDs[6]=7;    myYDs[6]=0.64529;
    myXDs[7]=8;    myYDs[7]=0.44514;
    //******** End of Sample Data Creation *******

    Curve myCrv(myXDs,myYDs);    // Create a Curve object    
    
    dYatXmax = yatxmax(myCrv);  // Demonstration of yatxmax

    printf("Y(%s) at Maximum of X(%s) = %g\n",strYName,strXName,dYatXmax);
}

Remark

The function used for fitting function parameter initialization.

See Also

Yatxmin

header to Include

origin.h

Reference