[Matplotlib] 정규분포 그리기
Python을 이용해 정규분포를 그려보려 한다. 정규분포의 pdf는 다음과 같다. 1. 직접 생성 위 식을 함수로 정의하면, 다음과 같다 import matplotlib.pyplot as plt import math def normal_pdf(x, mu=0, sigma=1): return(math.exp(-(x-mu)**2)/(2*sigma**2))/(math.sqrt(2*math.pi)*sigma) 다음과 같이 xs_1에 대한 정규분포를 구해보자(plot에 정수값을 넣을 수 없으므로, x/10을 대입) xs_1 = [x/10 for x in range(-50, 50)] plt.plot(xs_1, [normal_pdf(x) for x in xs_1]) 다양한 정규분포를 구해보면, plt.plot(xs, ..