This is the normal distribution you plotted in lab07 with a mean of zero and a sigma of 1.
If we want a random numbers with a Gaussian distribution of width σ centered about μ.
plt.subplot(3,1,2)
mu , sigma = 5,10
x2= sigma* np.random.randn(1000) + mu
To display the content of x1 and x2 we store and plot them in a histogram. A histogram can be thought of as a set of bins. Each element of an array (x1 or x2 ) is entered into one and only one of these bins.
Here you are plotting a histogram using matplotlib function hist.
Note: the options used here are one positional argument and the rest are Keyword arguments . The options are:
The positional argument x1. Where x1 is the array we would like to histogram
the number of bins in the histogram
the range of the histogram bins. In here we are plotting from -5 to 5.
Here we assigned return values of hist to be n2,b2,p2.
n2 and b2 are often useful. Add some print statements and see if you can figure out what they are.