# Creating a Gaussian Curve

1. Jul 27, 2011

### csand

Hi,
My understanding in this is limited, but I'm trying to create a set of Gaussian curve response functions that will be convoluted with some signal data. I've dug all around the internet/textbooks but I'm having trouble finding a way to create the curve with the data I have. All I know is the height is bound from 0 to 1 (or at least very very close to 0 for my purposes). I have the center value (x-axis) for every curve I need to generate, and I know the FWHM of every curve. So to generate a curve I will know:

-FWHM for the curve
-The center xaxis value (Denoted by Lambda_Center)
-The height

The only formula I have is unsourced and I'm not sure it's working properly for all cases:

e^( -1*(Lambda - Lambda_Center)^2 / (FWHM/2*sqrt(ln2))^2 )

I have Lambda_Center, and Lambda, if this were to be looped in a program, would increment/decrement by some value X for each point on the gaussian (ex: 0.1,0.2,0.3,0.4,L_C,0.4,0.3,0.2,0.1)

Does anyone recognize this formula/method for creating a gaussian? Can anybody see any big holes in the method? Everything I see online usually involves using sigma/mean.

Thanks,
-Chris

***EDIT***: fixed formula bracketing

Last edited: Jul 27, 2011
2. Jul 27, 2011

### pmsrw3

Looks right, except that you have some issues with parens and brackets. But look, there's an easy way to test it. You want the value to be 1 at Lambda_Center and 0.5 at Lambda_Center +- FWHM. So plug in those numbers and see if it works.

3. Jul 27, 2011

### csand

I have created some curve data with this formula, and for the most part the data seems reasonable. However, I find that sometimes I need hundreds of points just to see the function approach 0, and, unless I choose a very high resolution step (such as 0.01), I don't often find a 0.5, but values close to, such as 0.52xxxx,0.489xxxx, etc. I'm glad to know that the formula, other than the bracketing errors, appears legitimate.

Thanks,
-C

4. Jul 27, 2011

### pmsrw3

I'm not sure how closely you need it to get down to zero. It will get to 0.05 at 2.08 FWHM, to 0.01 at 2.58 FWHM, and 0.001 at 3.16 FWHM. Obviously, if your points are spaced such that FWHM is 100 of them, it's going to take hundreds of points to get down near zero. (I assume they're equally spaced.) Nothing to do about that.

You should not expect to get exactly 0.5 at any of your points unless the spacing of the points exactly divides FWHM and Lambda_Center exactly corresponds to one of the points.

I was not actually suggesting that you look at the points generates by your program. I was suggesting that YOU actually plug the numbers into the formula YOURSELF and check that it gives the right result.

EDIT: Oops! I just realized that, while I've been writing FWHM, I was actually thinking HWHM. So everything I've said so far is off by a factor of two. If you replace FWHM with FWHM/2 in the above, then it should be right.

Last edited: Jul 27, 2011