How can I create a Gaussian curve with given data?

  • Context: Undergrad 
  • Thread starter Thread starter csand
  • Start date Start date
  • Tags Tags
    Curve Gaussian
Click For Summary

Discussion Overview

The discussion revolves around creating Gaussian curve response functions using given data, specifically focusing on the parameters of height, center value, and full width at half maximum (FWHM). Participants explore the formulation of the Gaussian function and its implementation in programming, addressing issues related to accuracy and resolution.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant, Chris, presents a formula for generating a Gaussian curve based on FWHM, center value, and height, expressing uncertainty about its correctness.
  • Another participant points out potential issues with parentheses and suggests testing the formula by checking specific values at Lambda_Center and its relation to FWHM.
  • A third participant shares their experience of generating curve data, noting that achieving values close to 0.5 requires a high resolution and many points, indicating variability in results.
  • One participant discusses the relationship between point spacing and the accuracy of reaching values near zero, suggesting that exact values may not be achievable unless specific conditions are met.
  • A correction is made regarding the terminology used, clarifying that HWHM should be considered instead of FWHM, which may affect previous calculations.

Areas of Agreement / Disagreement

Participants express differing views on the accuracy and implementation of the Gaussian formula, with no consensus on the best approach or resolution of the issues raised. The discussion remains unresolved regarding the optimal method for generating the Gaussian curves.

Contextual Notes

Participants highlight limitations related to the spacing of points and the definitions of FWHM versus HWHM, which may impact the results and expectations of the Gaussian function.

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:

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 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
2
Views
1K