How can I create a Gaussian curve with given data?

  • Thread starter Thread starter csand
  • Start date Start date
  • Tags Tags
    Curve Gaussian
Click For Summary
To create a Gaussian curve using given data, the formula e^(-1*(Lambda - Lambda_Center)^2 / (FWHM/2*sqrt(ln2))^2) is suggested, but it requires careful attention to parentheses and brackets. The curve should reach a height of 1 at Lambda_Center and approximately 0.5 at Lambda_Center ± FWHM, although achieving exact values may be challenging due to point spacing. Testing the formula with specific values is recommended to verify its accuracy. The discussion highlights the importance of understanding the relationship between FWHM and HWHM, as errors in this distinction can affect results. Overall, the method appears valid, but adjustments may be necessary for precise outcomes.
csand
Messages
4
Reaction score
0
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:
Physics news on Phys.org
csand said:
e^[ -1*(Lambda - Lambda_Center)^2 / (FWHM]/2*sqrt(ln2))^2) ]
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.
 
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
 
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:
The standard _A " operator" maps a Null Hypothesis Ho into a decision set { Do not reject:=1 and reject :=0}. In this sense ( HA)_A , makes no sense. Since H0, HA aren't exhaustive, can we find an alternative operator, _A' , so that ( H_A)_A' makes sense? Isn't Pearson Neyman related to this? Hope I'm making sense. Edit: I was motivated by a superficial similarity of the idea with double transposition of matrices M, with ## (M^{T})^{T}=M##, and just wanted to see if it made sense to talk...

Similar threads

Replies
28
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
70K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
7
Views
10K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
2
Views
1K
  • · Replies 10 ·
Replies
10
Views
3K