Simulating Normal Distribution in Mathematica: Histogram and PDF Plotting

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 6K views
Sam_Goldberg
Messages
46
Reaction score
1
Hi guys,

On my homework, I'm simulating a normal distribution on Mathematica by adding up a bunch of RandomReal[] , that is, uniform(0,1) random variables, and using the central limit theorem. I would like to plot both the histogram and the actual Gaussian probability density function on the same graph, but it does not seem that I'm able to use both the Histogram and Plot functions at the same time. How should I do this? Thanks.
 
Physics news on Phys.org
You use "Show" to show multiple graphics at a time:

Show[Histogram[RandomReal[NormalDistribution[0, 1], 200]], Plot[Sin[x], {x, -6 Pi , 6 Pi}]]