如何验证下采样输出是否正确。例如,我做了一些例子,但是,我不确定输出是否正确?关于验证的任何想法代码import numpy as npimport matplotlib.pyplot as plt # For plotingfrom scipy import signalimport mnefs = 100 # sample ratersample=50 # downsample frequencyfTwo=400 # frequency of the signalx = np.arange(fs)y = [ np.sin(2*np.pi*fTwo * (i/fs)) for i in x]f_res = signal.resample(y, rsample)xnew = np.linspace(0, 100, f_res.size, endpoint=False)## ###############################plt.figure(1)plt.subplot(211)plt.stem(x, y)plt.subplot(212)plt.stem(xnew, f_res, 'r')plt.show()
添加回答
举报
0/150
提交
取消