Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CreateDocument[{
- SetDirectory[NotebookDirectory[]];
- DynamicModule[
- {x = 100, dist = 1, path, data},
- Column@{
- Grid[
- {{TextCell@"Choose Distribution:",
- PopupMenu[
- Dynamic@dist, {1 -> "Normal", 2 -> "Poission",
- 3 -> "Binomial", 4 -> "Maxwell", 5 -> "Uniform"}]
- },
- {TextCell@"Number of samples:",
- InputField[Dynamic[x], Number, ImageSize -> 100]}
- }
- ],
- Button["Generate & Plot",
- Which[
- dist == 1,
- CreatePalette@Histogram[RandomVariate[NormalDistribution[], x]],
- dist == 2,
- CreatePalette@
- Histogram[RandomVariate[PoissonDistribution[1], x]],
- dist == 3,
- CreatePalette@
- Histogram[RandomVariate[BinomialDistribution[40, 0.5], x]],
- dist == 4,
- CreatePalette@
- Histogram[RandomVariate[MaxwellDistribution[0.5], x]],
- dist == 5,
- CreatePalette@
- Histogram[RandomVariate[UniformDistribution[], x]],
- True,
- CreatePalette@
- Histogram[RandomVariate[NormalDistribution[1, 3], x]]]
- ],
- Row@{
- FileNameSetter[Dynamic@path];
- Button["Plot", {
- Dynamic@data = Import[Dynamic@path],
- FindDistribution[Dynamic@data],
- CreatePalette@Histogram[{data}]
- }
- ]
- }
- }
- ]
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment