LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Area under Curve for Unbounded Guassian & Laurentzian Distributions

Hi Don,

Assuming the Gaussian has the form: f(x) = a*exp{ -0.5*[(x-m)/s]^2}, then the total area under the curve (integral from -Inf to Inf) is exactly sqrt(2*pi)*a*s, and the fwhm is 2*sqrt(2*ln(2))*s.  It becomes a little trickier to evaluate the integral for limits other than +/- Inf.  The error function in LabVIEW is defined as:
erf(a) = [2/sqrt(pi)] * integral(from 0 to a) exp(-t^2) dt

let t = (x-m)/(sqrt(2)*s), and apply some algebra, and the integral(from 0 to a) f(x)dx = a*sqrt(2*pi)*s*erf[ (a-m)/(s*sqrt(2)]

Attached is a VI which compares results from Quadrature.vi (general purpose integrator) with the integral evaluated using erf() (error function.vi) and the closed-form expression sqrt(2*pi)*a*s.  The integral from -Inf to Inf is approximated by doubling the integral from 0 to 100.  As expected the erf-based integral is much faster than the adaptive quadrature algorithm.

If the Lorentzian has the form: f(x)=a/(1+((x-m)/c)^2), then total area (integral from -Inf to Inf) is pi*a*c, and the fwhm is 2*c

-Jim
Message 11 of 13
(903 Views)
Hello again.  Damien - somehow I missed the email notifying me of your above post and this is the first time that I am seeing it.  It appears you have confirmed that the estimation formulas are valid.

In the meantime, I looked to use a simple methodology to validate these formular methods, performed guassian and lorentzian fits followed by integrations and formular calculations.  After subtracting off rough estimates of the background, the numbers between the integrations and the formulas seem to agree pretty well.  I am including a graphic file showing the validation steps.  I will look at your VIs.  Thanks for taking a look at this...Don


Message Edited by DonRoth on 06-09-2008 02:50 PM

Message Edited by DonRoth on 06-09-2008 02:52 PM
0 Kudos
Message 12 of 13
(861 Views)
ps. Jim - I thought you were Damien, sorry about that!! Thanks for looking at this...Don
0 Kudos
Message 13 of 13
(852 Views)