MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fit Gaussian function to histogram

  • To: mathgroup at
  • Subject: [mg117814] Re: Fit Gaussian function to histogram
  • From: Alexei Boulbitch <alexei.boulbitch at>
  • Date: Thu, 31 Mar 2011 06:04:36 -0500 (EST)


try this:

data = RandomVariate[NormalDistribution[], 1000];
hist = Histogram[data, "Wand", "PDF", Frame -> True];
dist = EstimatedDistribution[data,
    NormalDistribution[\[Mu], \[Sigma]]];
distPlot = Plot[PDF[dist, x], {x, -4, 4}, PlotStyle -> {Thick, Red}];
Show[{hist, unimodalDistPlot1}, Epilog -> Inset[
       Row[{Style["\[Mu] \[TildeTilde]", 12, Blue], Spacer[5],
         Style[NumberForm[dist[[1]], {4, 2}], 12, Blue]

       Row[{Style["\[Sigma] \[TildeTilde]", 12, Blue], Spacer[5],
                        Style[NumberForm[dist[[2]], {4, 2}], 12, Blue]
                     Row[{Style["Test: ", 10, Blue], Spacer[5],

         Style[NumberForm[DistributionFitTest[data, dist],
                             {4, 3}],      12, Blue]
                                 }], Scaled[{0.15, 0.7}]

Fave fun, Alexei

-----Original Message-----
From: cubsfan334 [mailto:cubsfan334  at]
Sent: Tuesday, March 29, 2011 7:55 AM
To: mathgroup at
Subject: [mg117814] [mg117695] [mg117655] Fit Gaussian function to histogram


I realize that I can generate a histogram from a data set using the
Histogram[{data},bin size] command, yet this only seems to create a
graphic.  Is there anyway to fit a function (preferably Gaussian) to
the histogram Mathematica creates?


Alexei Boulbitch, Dr. habil.
Senior Scientist
Material Development

ZAE Weiergewan
11, rue Edmond Reuter

Tel: +352 2454 2566
Fax: +352 2454 3566
Mobile: +49 (0) 151 52 40 66 44

e-mail: alexei.boulbitch at


This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended
recipient and have received this e-mail in error, you are hereby
notified that any review, copying or distribution of it is strictly
prohibited. Please inform us immediately and destroy the original
transmittal from your system. Thank you for your co-operation.

  • Prev by Date: Re: read CSV
  • Next by Date: Re: Coordinates from Graphics3D images
  • Previous by thread: Re: Fit Gaussian function to histogram
  • Next by thread: specifying further options to NMinimize method when using NonlinearModelFit