MathGroup Archive 2008

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

Search the Archive

Re: Plotting against Normal

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91573] Re: [mg91559] Plotting against Normal
  • From: George Woodrow III <georgevw3 at mac.com>
  • Date: Thu, 28 Aug 2008 03:15:39 -0400 (EDT)
  • References: <200808271043.GAA21230@smc.vnet.net>

Here is some code that works for me:

Needs["Histograms`"]


gauss[x_, =CE=BC_, =CF=83_] := Exp[-(((x - =CE=BC)/=CF=83)^2/2)]/(=CF=83 Sqrt[2 =CF=80]);

gradeDistGraph[\[Mu]_, \[Sigma]_, theData_List] := Module[{curve, 
hist, scale, maxBin},
maxBin = Max[BinCounts[theData,{0, 100, 1}]];
scale = maxBin/gauss[\[Mu], \[Mu], \[Sigma]];
curve = Plot[ scale gauss[x, \[Mu], \[Sigma]], {x, 0, 100}, PlotStyle -
 > Thick, PlotRange -> {{0, 100}, All}];
hist = Histogram[theData, HistogramRange -> {0, 100}, 
HistogramCategories -> 100, GridLines -> Automatic];
Show[hist,curve, PlotRange -> All, ImageSize -> {500, 250}, 
AspectRatio -> 3/10, Frame -> True, FrameLabel -> {{"frequency", " "}, 
{"grade", "Distribution of computed grades"}}]]


The trick is to get the scale for gaussian curve to match the max for 
the histogram. You can vary the range, etc. to suit.

george


On Aug 27, 2008, at 6:43 AM, ouadad wrote:

> Can anyone point me to the algorithm that allows you to plot a 
> histogram of data with a Normal Dist curve superimposed?
>



  • Prev by Date: Re: Re: Mathematica and F# [OT]
  • Next by Date: Re: Catching messages
  • Previous by thread: Plotting against Normal
  • Next by thread: RE: Plotting against Normal