Central Limit Theorem Demo
Version 1.0.0 (3.51 KB) by
B.R.P
This illustrates the Central Limit Theorem and lets you see how the distribution of sample means gradually approaches a normal curve.
Central Limit Theorem
This is an interactive tool to illustrate the Central Limit Theorem. It lets you take random samples from different distributions and see how the distribution of sample means gradually approaches a normal curve.
Features
- Several distributions to choose from: Normal, Uniform, Exponential, Bernoulli, Poisson, and Student’s t
- Adjustable distribution parameters (e.g. mu, sigma, lambda, p, nu)
- Sliders to set:
- sample size per trial (n)
- total number of sample means (M)
- number of means added per animation step
- Two plots shown side by side:
- Population vs the current sample
- Histogram of sample means with the matching normal curve
- Start, pause, and reset controls for running the animation
Why use it?
This script is handy for teaching or reviewing probability and statistics. It provides a clear, real-time demonstration of the CLT and shows that the result holds regardless of the shape of the original distribution.
How to run
Just type:
clt_demo
Pick a distribution, adjust the sliders, and press Start to watch the convergence in action.
Notes
- No special toolboxes required.
- The layout is simple enough to use in lectures or as a self-study aid.
Cite As
B.R.P (2025). Central Limit Theorem Demo (https://www.mathworks.com/matlabcentral/fileexchange/182173-central-limit-theorem-demo), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2025b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
