(本文是北理工嵩天老师MOOK课程笔记之一)
# -*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as plt from scipy.io import wavfile rate_h,hstrain=wavfile.read(r"H1_Strain.wav","rb") rate_l,lstrain=wavfile.read(r"L1_Strain.wav","rb") reftime,ref_H1=np.genfromtxt('wf_template.txt').transpose() hi=1/rate_h li=1/rate_l htime_len=hstrain.shape[0]/rate_h htime=np.arange(-htime_len/2,htime_len/2,hi) ltime_len=lstrain.shape[0]/rate_l ltime=np.arange(-ltime_len/2,ltime_len/2,li) fig=plt.figure(figsize=(12,6)) plth=fig.add_subplot(221) plth.plot(htime,hstrain,'y') pltl=fig.add_subplot(222) pltl.plot(ltime,lstrain,'g') pltt=fig.add_subplot(212) pltt.plot(reftime,ref_H1) fig.tight_layout() plt.show() plt.close(fig)
版权声明:本文为qq_36142336原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。