The data is a list of measurements of power $P_i$ with estimated uncertainty $\Delta P_i$ and another list with measurements of positions $x_i$ and estimated uncertainties $\Delta x_i$. All the $\Delta x_i$ have the same value. It looks like a Gaussian distribution and I want to find its FWHM.

I have heard of the method of least squares. For this I just need fit function (Gaussian), the $P_i$, the $x_i$ and the $\Delta P_i$. The problem is that I do not know how to use the uncertainty in position with this method.


The problem is not mathematically simple, and if you're not already familiar with the least square method, it might be a bit overwhelming. A least square regression with uncertainties both in the independent and dependent variables is frequently called Total Least Squares.

In addition to the linked Wikipedia article, you can find the theory and further references in the following guide (available from the National Physical Laboratory, UK, upon free registration), section 4.3 Generalised distance regression (GDR):

R M Barker, M G Cox, A B Forbes and P M Harris, Discrete Modelling and Experimental Data Analysis, NPL Report DEM-ES 018, 2007.

Several software tools like SciPy, Matlab, etc. have functions that perform this kind of regression with minimum effort. I invite you to search the documentation of your favourite tool to find which functions are available.

| cite | improve this answer | |
  • $\begingroup$ Thanks, I found out the Python library Scipy has it very nicely implemented. On stackoverflow there is some example code. $\endgroup$ – ty. Sep 17 '17 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.