国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python+matplotlib實現計算兩個信號的交叉譜密度實例

2020-02-16 11:32:08
字體:
來源:轉載
供稿:網友

 計算兩個信號的交叉譜密度

結果展示:

完整代碼:

import numpy as npimport matplotlib.pyplot as pltfig, (ax1, ax2) = plt.subplots(2, 1)# make a little extra space between the subplotsfig.subplots_adjust(hspace=0.5)dt = 0.01t = np.arange(0, 30, dt)# Fixing random state for reproducibilitynp.random.seed(19680801)nse1 = np.random.randn(len(t))         # white noise 1nse2 = np.random.randn(len(t))         # white noise 2r = np.exp(-t / 0.05)cnse1 = np.convolve(nse1, r, mode='same') * dt  # colored noise 1cnse2 = np.convolve(nse2, r, mode='same') * dt  # colored noise 2# two signals with a coherent part and a random parts1 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse1s2 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse2ax1.plot(t, s1, t, s2)ax1.set_xlim(0, 5)ax1.set_xlabel('time')ax1.set_ylabel('s1 and s2')ax1.grid(True)cxy, f = ax2.csd(s1, s2, 256, 1. / dt)ax2.set_ylabel('CSD (db)')plt.show()

總結

以上就是本文關于Python+matplotlib實現計算兩個信號的交叉譜密度實例的全部內容,希望對大家有所幫助。感興趣的朋友可以繼續參閱本站其他相關專題,如有不足之處,歡迎留言指出。感謝朋友們對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五寨县| 临沧市| 霸州市| 泉州市| 新密市| 建瓯市| 滦南县| 万荣县| 金华市| 象山县| 平谷区| 武强县| 萝北县| 叶城县| 大方县| 景德镇市| 北票市| 全椒县| 承德县| 垦利县| 宣威市| 扶风县| 定西市| 定襄县| 阿克苏市| 府谷县| 铜梁县| 名山县| 剑阁县| 祁东县| 天长市| 玉门市| 上高县| 定兴县| 呈贡县| 九台市| 昌吉市| 册亨县| 邵武市| 扶余县| 叶城县|