-
-
Save harrysarson/0c1344dab1ff0ef79b98aa4a9abe02e8 to your computer and use it in GitHub Desktop.
3F3 Lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Plot normal distribution: | |
figure(1) | |
x=randn(1000,1); | |
subplot(211), | |
hist(x,20) | |
subplot(212), | |
ksdensity(x,’width’,0.1) | |
% Plot uniform distribution: | |
figure(2) | |
x=rand(1000,1); | |
subplot(211), | |
% Be aware that when specifying bin centres as below, Matlab will include everything | |
% from -infinity to the first bin centre in the first bin, | |
% and the top bin to +infnity in the last bin | |
hist(x,[-1.45:0.1:1.45]) | |
subplot(212), | |
ksdensity(x,’width’,0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment