2018年1月23日 星期二

直方圖(Histogram)


直方圖(Histogram)

Python

使用 matplotlib.pyplot 的 hist() 方法。
import numpy as np import matplotlib.pyplot as plt normal_samples = np.random.normal(size = 100000) # 生成 100000 組標準常態分配(平均值為 0,標準差為 1 的常態分配)隨機變數 uniform_samples = np.random.uniform(size = 100000) # 生成 100000 組介於 0 與 1 之間均勻分配隨機變數 plt.hist(normal_samples) plt.show() plt.hist(uniform_samples) plt.show()


沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...