import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname='/Library/Fonts/Songti.ttc')#Mac 系统下防止图像标题中文出现乱码。
x=np.linspace(0,6,1000)
noise=np.random.normal(0,0.08,1000)
y1=np.sin(x)+noise
y2=np.cos(x+0.124)+noise
plt.plot(x,y1,x,y2)
plt.xlabel("时间(μs)",fontproperties=font)
plt.ylabel("幅值(V)",fontproperties=font)
plt.title("噪声污染下的信号",fontproperties=font)
plt.show()
运行结果: