Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: gaussian2d - Function Up: mathematics - Module Previous: sinusoidfittertest - Function


gaussian1d - Function



Package utility
Module mathematics


Calculate a one-dimensional Gaussian


Synopsis
gaussian1d(x, height, center, fwhm)

include "gaussian.g"



Description

The gaussian1d function evaluates one-dimensional Gaussians. You can specify the peak height of the Gaussian, the center of the Gaussian and the width of the Gaussian.

The width of the Gaussian is defined to be the full width at half-maximum (FWHM). If you prefer to use ``natural'' widths, a constant fwhm_to_natural is provided1.3. To get a natural width, multiply the FWHM by this constant 1.4. Similarly the FWHM is derived by dividing the natural width by this constant.

You can evaluate the Gaussian at a number of positions by passing the function a vector for ``x'' instead of a scalar.



Arguments

x in values at which to evaluate the Gaussian
    Allowed: double
    Default: no default
height in maximum value of the Gaussian
    Allowed: double
    Default: 1.0
center in location of the maximum value of the Gaussian
    Allowed: double
    Default: 0.0
fwhm in width of the gaussian
    Allowed: double
    Default: 1/fwhm_to_natural


Returns
The ``y'' values or fail



Example
This simple example calculates and plots a Gaussian.
      include 'gaussian.g';
      x := 1:100;
      y := gaussian1d(x, height=3, center=30, fwhm=20);
And then plot the example, marking the peak and FWHM of the Gaussian.
      include 'pgplotter.g';
      pg := pgplotter();
      pg.env(1, 100, 0, 3, 0, 0);
      pg.line(x,y);                   # Plot the Gaussian
      pg.line([30,30], [0, 3]);       # Show the center

      # Show the FWHM
      pg.line([30-20/2, 30-20/2, 30+20/2, 30+20/2],   # x
	      [0,       3/2,     3/2,     0]);        # y


See Also
gaussian2d



next up previous contents index
Next: gaussian2d - Function Up: mathematics - Module Previous: sinusoidfittertest - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15