1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gaussian of best fit

  1. Jul 8, 2012 #1
    Hello, I have a set of data on an x-y plot in Matlab and I'm trying to calculate the Gaussian distribution of best fit, I only want the right hand side of the Gaussian. I tried applying the least squares method but it gets messy. can you help me?
  2. jcsd
  3. Jul 8, 2012 #2


    User Avatar
    Science Advisor

    I am not sure about the one-sided business. However, usually to get a best fit Gaussian, compute the mean and variance of the data and use a Gaussian with those quantities.
  4. Jul 9, 2012 #3


    User Avatar
    Science Advisor

    Hey chapter and welcome to the forums.

    I'm curious about this one-sided thing and in some circumstances, this may not be a good idea. Can you tell us the context of your problem and what you are trying to do overall?
  5. Jul 9, 2012 #4


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Just to clarify, there's a difference between the variance of the data and the estimated variance of the population. To get the variance of the data (just as a collection of numbers), you divide the sum square (value-mean) by N, the number of datapoints. To get the unbiased estimate of the variance of the population you divide by N-1 instead.
  6. Jul 9, 2012 #5
    Hello, yes when I said one sided I meant that my data only covers the positive side of the distribution. While usually yes all you have to do is get the mean and the variance, my data already follows the shape of a Gaussian and I'm trying to find the best fit for the general case, its a little bit like trying to find the line of best fit using the least mean square error but instead its the Gaussian of best fit.

    I have tried using the least mean square error approach but the differential equations of the Gaussian get a bit messy.

    here is an example of the data I'm trying to get the Gaussian of best fit to

  7. Jul 9, 2012 #6
    That doesn't strike as a particularly "Gaussian" distribution. Honestly, fitting something like a Weibull distribution seems like a better bet to me for a few reasons, not the least of which because it's strictly positive. The stat toolbox in matlab should let you fit the distribution using maximum likelihood estimation.
  8. Jul 9, 2012 #7
    ok I'll give the Matlab stat toolbox a shot. This is just one example of a graph, I will need to plot hundreds at some point when I can get a line of best fit. I agree that this doesn't fit well with a Gaussian but the my whole thesis is based on proof that this should - be it very badly correlated most of the time.

    The problem is I have an extremely limited number of separations between the radar I'm using which massively limits the number of points I can plot
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook