MathGroup Archive 2011

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

Search the Archive

Re: Fit Gaussian function to histogram

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

Hi,

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[
    Panel@Column[{
       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 gmail.com]
Sent: Tuesday, March 29, 2011 7:55 AM
To: mathgroup at smc.vnet.net
Subject: [mg117814] [mg117695] [mg117655] Fit Gaussian function to histogram

Hi,

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?

Thanks!


-- 
Alexei Boulbitch, Dr. habil.
Senior Scientist
Material Development

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 CONTERN
Luxembourg

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

e-mail: alexei.boulbitch at iee.lu

www.iee.lu

--

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