Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1364

Re: Fit Gaussian function to histogram

From Alexei Boulbitch <alexei.boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Fit Gaussian function to histogram
Date 2011-03-31 11:04 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <in1n41$6rh$1@smc.vnet.net> (permalink)

Show all headers | View raw


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:   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@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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Fit Gaussian function to histogram Alexei Boulbitch <alexei.boulbitch@iee.lu> - 2011-03-31 11:04 +0000

csiph-web