xatymax

 

Description

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

Syntax

double xatymax( Curve & crv )

Parameters

crv
[input] Origin C Curve object

Return

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

Examples

EX1

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

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

    Curve myCrv(myXDs,myYDs);    // Create a Curve object    
    
    dXatYmax = xatymax(myCrv);  // Demonstration of xatymax
    
    printf("X at Maximum of Y(%s) = %g\n", strYName,dXatYmax);
}

Remark

The function used for fitting function parameter initialization.

See Also

Xatymin

Header to Include

origin.h

Reference