How can I create a Gaussian curve with given data?

In summary, the author is trying to create a set of Gaussian curve response functions that will be convoluted with some signal data. He has the center value (x-axis) for every curve he needs to generate, and he knows the FWHM of every curve. He wants the value to be 1 at Lambda_Center and 0.5 at Lambda_Center +- FWHM. He has created some curve data with this formula, and for the most part the data seems reasonable. However, he finds that sometimes he needs hundreds of points just to see the function approach 0, and, unless he chooses a very high resolution step (such as 0.01), he doesn't often find a 0.5,
  • #1
csand
4
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
  • #2
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.
 
  • #3
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
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:
  • #5


Hello Chris,

Creating a Gaussian curve with given data can be done using the formula you have provided, which is the standard Gaussian probability density function. This formula is commonly used in statistics and probability to represent a normal distribution.

To ensure that the formula is working properly for all cases, it is important to understand the parameters involved. The FWHM (full width at half maximum) determines the width of the curve, while the Lambda_Center represents the mean or center value of the curve. The height of the curve will depend on the maximum value of your data.

In order to create a curve for each data point, you can use a loop in your program to increment or decrement the Lambda value by a fixed interval (X) as you have mentioned. This will generate a curve for each data point with the given FWHM and Lambda_Center values.

It is worth noting that the use of sigma and mean is another way to represent the FWHM and Lambda_Center values. They are related by the formula FWHM = 2*sqrt(2*ln2)*sigma, where sigma is the standard deviation and mean is the average of your data.

Overall, your method for creating a Gaussian curve with given data seems valid. However, it is always recommended to test the results and compare them with known Gaussian curves to ensure accuracy. Additionally, you can also explore other methods and algorithms for generating Gaussian curves, such as the Box-Muller transform or the Metropolis-Hastings algorithm.

I hope this helps. Best of luck with your project.

Sincerely,
 

1. What is a Gaussian curve?

A Gaussian curve, also known as a normal distribution, is a bell-shaped curve that represents the probability distribution of a continuous random variable. It is characterized by a mean value and a standard deviation, and is commonly used in statistics and data analysis.

2. How is a Gaussian curve created?

A Gaussian curve is created by plotting a series of data points that follow a normal distribution. These data points are then connected with a smooth curve to form the characteristic bell shape. The curve is centered around the mean value and the standard deviation determines the spread of the curve.

3. What are the properties of a Gaussian curve?

The properties of a Gaussian curve include symmetry around the mean value, with 50% of the data falling on either side. It also has a single peak at the mean value and tails that extend infinitely in both directions. The total area under the curve is equal to 1, representing 100% of the data.

4. Why is the Gaussian curve important?

The Gaussian curve is important because it is a common distribution that occurs in many natural phenomena, such as human height, test scores, and measurement errors. It also has many useful properties and is used in statistical analysis to make predictions and calculate probabilities.

5. How is the Gaussian curve used in real life?

The Gaussian curve is used in various fields such as finance, physics, and engineering to model and analyze data. It is also used in quality control to determine the normal range of a process and in medical research to analyze the effectiveness of treatments. It is a fundamental tool in data analysis and decision making.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
67K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
9K
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Replies
1
Views
3K
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
Back
Top