Yes, you need to create a curve and there are two problems...
1. I can't find a way to create an Origin C curve from unattached datasets, which are datasets that are not in worksheets.
You can get around that by invoking LabTalk.
2. The fwhm function finds the width of a peak whereas your function describes a decaying exponential-like curve.
fwhm will never return a value for such a curve, i.e., fwhm(MyCrv)=--.
I think you want the X value at which Y = half maximum.
Try the following function. (If you want to try fwhm move the // from that line to the next.)
You can create a text label that runs the function with a command like this...
type -a "width: $(XatHalfMax())". (Instructions)
double XatHalfMax()
{
GraphLayer gl = Project.ActiveLayer();
DataPlot dp = gl.DataPlots(-1);
string sYname = dp.GetDatasetName();
char chX[23];
string sCmd;
sCmd.Format("%%A=xof(%s)",sYname);
gl.LT_execute(sCmd);
LT_get_str("%A",chX,23);
Worksheet wks;
wks.Create();
wks.LT_execute("col(1) = " + chX);
wks.LT_execute("col(2) = " + sYname);
Dataset dsX(wks,0);
Dataset dsY(wks,1);
Curve cc(dsX,dsY);
//double dWidth = fwhm(cc);
double dWidth = Curve_xfromY(&cc, max(cc)/2.0);
wks.Destroy();
return dWidth;
}
Mike Buess
Origin WebRing Member
Edited by - Mike Buess on 05/09/2007 1:09:11 PM