gaussian
Introduced in 0.99
Synopsis

Gaussian line shape.

y = gaussian(x,x0,fwhm)
y = gaussian(x,x0,fwhm,diff)
Description

This function returns a Gaussian lineshape with centre x0 and full width at half height fwhm over the abscissa values defined in the vector x.

diff determines the derivative to compute. 0 stands for no derivative, 1 is the first one, 2 the second one, -1 indicates the integral with [eqn] as lower limit. If diff is not given, it is set to 0 by default.

Examples

To obtain a Gaussian with centre at 34 and FWHM of 20, use

x = linspace(-100,100,1e3); x0 = 34; w = 20;
y = gaussian(x,x0,w);
plot(x,y);

The Gaussian is normalised, its integral is one.

sum(y)*(x(2)-x(1))
ans =
    1.0000
See also

convspec, lorentzian, lshape, voigtian