2.1.17.2.1.1 fwhm


Description

Get the peak width of a curve at half the maximum Y value.

Syntax

double fwhm( Curve & crv, double dYoffset = 0 )

Parameters

crv
[input] Origin C Curve object
dYoffset
[input] Y offset subtracted from curve

Return

Returns the peak width of a curve at half the maximum Y value.

Examples

EX1

// This is a self contained sample program for the function fwhm, 
// Its sample data is created at the beginning of the program. 
// To run the program, enter the following command in the Script window:
//   fwhm_ex1
// This will return the result like following:
//   fwhm_ex1
// It returns like:
//   The peak width of Data2_B at the half max = 2.56744 (with offset=0.5)
void fwhm_ex1()
{
	double dYoffset, dWx;
 
	Worksheet wks;
	wks.Create();
	Dataset myXDs(wks,0);
	Dataset myYDs(wks,1);
	String strYName = myYDs.GetName();
 
	//******* Create sample data *****************
	myXDs.SetSize(11);
	myYDs.SetSize(11);
	myXDs[0]=0.56055;  myYDs[0]=0.62197;
	myXDs[1]=1.19723;  myYDs[1]=0.75321;
	myXDs[2]=2.18916;  myYDs[2]=1.40942;
	myXDs[3]=2.79123;  myYDs[3]=2.89872;
	myXDs[4]=3.39562;  myYDs[4]=4.29957;
	myXDs[5]=3.96078;  myYDs[5]=4.6933;
	myXDs[6]=4.59977;  myYDs[6]=4.43081;
	myXDs[7]=5.02422;  myYDs[7]=3.24964;
	myXDs[8]=5.45098;  myYDs[8]=1.93723;
	myXDs[9]=6.51211;  myYDs[9]=1.01569;
	myXDs[10]=7.50634; myYDs[10]=0.66762;
	//******** End of Sample Data Creation *******
 
	Curve crv(myXDs,myYDs);
 
	dYoffset = 0.5;
	dWx = fwhm(crv,dYoffset);  // Demonstration of fwhm
 
	printf("The peak width of %s at the half max = %g (with offset=%g)\n",strYName,dWx,dYoffset);
}

Remark

The function used for fitting function parameter initialization.

See Also

peak_pos, get_exponent


Header to Include

origin.h

Reference