亚洲免费在线视频-亚洲啊v-久久免费精品视频-国产精品va-看片地址-成人在线视频网

您的位置:首頁技術(shù)文章
文章詳情頁

利用python繪制正態(tài)分布曲線

瀏覽:3日期:2022-06-30 13:24:28

使用Python繪制正態(tài)分布曲線,借助matplotlib繪圖工具;

利用python繪制正態(tài)分布曲線

#-*-coding:utf-8-*-'''python繪制標(biāo)準(zhǔn)正態(tài)分布曲線'''# ==============================================================import numpy as npimport mathimport matplotlib.pyplot as pltdef gd(x, mu=0, sigma=1): '''根據(jù)公式,由自變量x計算因變量的值 Argument: x: array 輸入數(shù)據(jù)(自變量) mu: float 均值 sigma: float 方差 ''' left = 1 / (np.sqrt(2 * math.pi) * np.sqrt(sigma)) right = np.exp(-(x - mu)**2 / (2 * sigma)) return left * rightif __name__ == ’__main__’: # 自變量 x = np.arange(-4, 5, 0.1) # 因變量(不同均值或方差) y_1 = gd(x, 0, 0.2) y_2 = gd(x, 0, 1.0) y_3 = gd(x, 0, 5.0) y_4 = gd(x, -2, 0.5) # 繪圖 plt.plot(x, y_1, color=’green’) plt.plot(x, y_2, color=’blue’) plt.plot(x, y_3, color=’yellow’) plt.plot(x, y_4, color=’red’) # 設(shè)置坐標(biāo)系 plt.xlim(-5.0, 5.0) plt.ylim(-0.2, 1) ax = plt.gca() ax.spines[’right’].set_color(’none’) ax.spines[’top’].set_color(’none’) ax.xaxis.set_ticks_position(’bottom’) ax.spines[’bottom’].set_position((’data’, 0)) ax.yaxis.set_ticks_position(’left’) ax.spines[’left’].set_position((’data’, 0)) plt.legend(labels=[’$mu = 0, sigma^2=0.2$’, ’$mu = 0, sigma^2=1.0$’, ’$mu = 0, sigma^2=5.0$’, ’$mu = -2, sigma^2=0.5$’]) plt.show()

以上就是利用python繪制正態(tài)分布曲線的詳細(xì)內(nèi)容,更多關(guān)于python 正態(tài)分布的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 美女视频黄在线观看 | 美女被拍拍拍拍拍拍拍拍 | 99毛片| 一区二区三区观看 | 久久久久99精品成人片三人毛片 | 久草在线国产视频 | 国内美女福利视频在线观看网站 | 国产精品国产三级国产专播 | 欧美另类 videos黑人极品 | 久久只有精品视频 | 三级毛片大全 | 久久久久久一品道精品免费看 | 国产女王女m视频vk 国产女王丨vk | 久草资源免费 | 亚洲成人黄色网 | 久久一区二区精品综合 | 最新亚洲一区二区三区四区 | 久久99热只有视精品6国产 | 欧美性三级| 她也啪在线视频 | 国产成人精品系列在线观看 | 老司机免费福利午夜入口ae58 | 国产免费久久精品久久久 | 在线视频 日韩 | 肥婆毛片| 97se亚洲综合在线 | 无圣光福利视频 | 久久久综合视频 | 91香蕉视频网| 亚洲视屏在线 | 日韩欧美成人乱码一在线 | 国产精品手机视频一区二区 | 亚洲 欧美 手机 在线观看 | 成年女人毛片免费观看中文w | 久久综合狠狠综合久久综合88 | 日韩在线视频线视频免费网站 | 欧美另类久久久精品 | 失禁h啪肉尿出来高h健身房 | 亚洲欧美视屏 | 国产或人精品日本亚洲77美色 | 欧美精品aaa久久久影院 |