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


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

Re: Fit Gaussian function to histogram

Started byAlexei Boulbitch <alexei.boulbitch@iee.lu>
First post2011-03-31 11:04 +0000
Last post2011-03-31 11:04 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

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

#1364 — Re: Fit Gaussian function to histogram

FromAlexei Boulbitch <alexei.boulbitch@iee.lu>
Date2011-03-31 11:04 +0000
SubjectRe: Fit Gaussian function to histogram
Message-ID<in1n41$6rh$1@smc.vnet.net>
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.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web