So based on my understanding of normal distribution the mean is zero by default when the standard deviation is 1. I was given an assignment to write a python program to generate a PDF of a normally distributed function with the range from 10 to 45 with a standard deviation of 2. Will the mean still be zero? I tried this but my plot doesn't form a bell shape. I don't know what I am doing wrong.
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
mu=0 # mean
sigma=2
x=np.arange(10,45,0.1)
y=stats.norm.pdf(x, 0, sigma)
plt.plot(x,y)
plt.show()
See my plot here: myplot
Here since the range of random variables is between 10 to 45, so the mean will lie in between this range of values, around 27. You need to get the same using the mean function and then use your code as follows:
y=stats.norm.pdf(x, x.mean(), sigma )