Fanning Software Consulting

Gaussian Distribution with Specified Mean and Sigma

QUESTION: I have to simulate noise in my experiment, so I want to create arrays with a normal (Gaussian) distribution of random numbers, but with a specific full width half maximum (FWHM) and mean. Is this also known as the sigma?

ANSWER: Sigma is related to FWHM by the equation:

   sigma = FWHM / ( 2 * SQRT(2* ALOG(2)) )

This is typically written as:

   sigma = FWHM / 2.35

In IDL you can create an array of random numbers in a normal or Gaussian distribution, with a sigma of standard deviation of 1 with the RANDOMN function. For example, to create 1000 random numbers, you type this:

   array = RANDOMN(seed, 1000)

The formula for creating a new distribution of number with a new sigma and mean is this:

   new_distribution = array * sigma + mean

So if you want a Gaussian distribution with a mean of 50 and a sigma of 3.5, the you simply do this:

   sigma = 3.5
   mean = 50.0
   array = RANDOMN(seed, 1000)
   new_distribution = array * sigma + mean

A distribution with these characteristics would have a FWHM calculated like this:

   fwhm = sigma * ( 2 * SQRT(2* ALOG(2)) )

Web Coyote's Guide to IDL Programming