官方手册
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.html?highlight=resample#scipy.signal.resample
scipy.signal.resample(x,num) num是int,是经过resample之后的符号长度,不是上采样率,不过有的时候采样不是整数会有偏差,比如期待输出5个符号,可能输出4个,输出是numpy类型的数据
from scipy import signal
x=[i for i in range(1,201)]
y=signal.resample(x,100)
tx=np.linspace(0,10,200,endpoint=False)
ty=np.linspace(0,10,100,endpoint=False)
plt.plot(tx,x,'-')
plt.plot(ty,y,'.-')
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample_poly.html#scipy.signal.resample_poly
scipy.signal.resample_poly(x,up,down)
The signal x is upsampled by the factor up, a zero-phase low-pass FIR filter is applied, and then it is downsampled by the factor down. The resulting sample rate is up/down
times the original sample rate. By default, values beyond the boundary of the signal are assumed to be zero during the filtering step.
这个函数就和matlab里面的resample是一样的,一般用法是up写目标采样率,down写当前采样率
from scipy import signal
x=[i for i in range(1,11)]
y=signal.resample_poly(x,1,2)
x=[1:10];
y=resample(x,1,2)