# 2.1.17.2.6.6 xaty50

## Description

Get the interpolated value of X at the average of minimum and maximum of Y values of a curve.

## Syntax

double xaty50( Curve & crv )

## Parameters

crv
[input] Origin C Curve object

## Return

Returns the interpolated value of X at the average of minimum and maximum of Y values of a curve.

## Examples

EX1

// This is a self contained sample program for the function xaty50,
// Its sample data is created at the beginning of the program.
// To run the program, enter the following command in the Script window:
//   xatY50_ex1
// It returns like:
//   X at the average of min & max of Y(Data4_B) = 7.05116

void xaty50_ex1()
{
double dXatY50;

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[0]=1;    myYDs[0]=0;
myXDs[1]=2;    myYDs[1]=0.2476;
myXDs[2]=3;    myYDs[2]=0.24909;
myXDs[3]=4;    myYDs[3]=0.3;
myXDs[4]=5;    myYDs[4]=0.41256;
myXDs[5]=6;    myYDs[5]=0.44514;
myXDs[6]=7;    myYDs[6]=0.47304;
myXDs[7]=8;    myYDs[7]=1;
//******** End of Sample Data Creation *******

Curve crv(myXDs,myYDs);

dXatY50 = xaty50(crv);  // Demonstration of xatY50
printf("X at the average of min & max of Y(%s) = %g\n",strYName,dXatY50);
}

## Remark

The function used for fitting function parameter initialization.

Get the interpolated value of X at the average of minimum and maximum of Y values of a curve.