RE: FWHM, InterpolationFunction & Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg80453] RE: [mg80418] FWHM, InterpolationFunction & Solve
• From: "David Annetts" <davidannetts at aapt.net.au>
• Date: Thu, 23 Aug 2007 00:58:13 -0400 (EDT)
• References: <200708220839.EAA08527@smc.vnet.net>

```Hi Mathieu

< snippage>

> Can you help me please? How would you do that?

When I last needed to do this, Ted Ersek's RootSearch package worked very
well.  The package is still available on MathSource & seems to work well
enough

> I then want to compute the area under the peak:
>
> Integrate[DataInterpolation[x], {x, BegFWHM, EndFWHM}]
>
> Which works fine with the interpolating function.

I'll use (very noisy, just to make it interesting) synthetic data after

Needs["Enhancements`RootSearch`"]
samp = {#, Sin[#] + RandomReal[{-.1, .1}]} & /@ Range[0, Pi,
Pi/128];
smax = Max[samp[[All, 2]]]
ListPlot[samp, Joined -> True, GridLines -> {None, {smax/2}}, Mesh
-> All]
sint = Interpolation[samp];

We find the boundaries of the peak at half-height using

hmax = t /. RootSearch[sint[t] == smax/2., {t,
First@First@First@sint, Last@First@First@sint}]

And the area using

slimit = Flatten[#] & /@ (Join[{t, #}] & /@ Partition[hmax, 2, 1])
areas  = Plus @@ (Integrate[sint[t], #] & /@ slimit)

Which compares favourably to the correct value

areaa = Integrate[Sin[t], Join[{t}, Sequence@hmax]]

Limits above appear complicated, but really only account for noisy or
pathological data.