spkit
.sinc_interp¶
- spkit.sinc_interp(x)¶
Sinc interpolation
Upsampling input signal with a factor of 2
Using FFT approach to smooth the interpolated zeros.
- Parameters:
- x: 1d-array
input signal, with length of n
- Returns:
- y: 1d-array
upsampled by factor of 2, with length of 2*n -1
Notes
There are effects on boundary
Examples
#sp.sinc_interp import numpy as np import matplotlib.pyplot as plt import spkit as sp fs=50 x = sp.create_signal_1d(n=50,seed=2,sg_winlen=20) y = sp.sinc_interp(x.copy()) t = np.arange(len(x))/fs t0 = np.arange(len(y))/(2*fs) plt.figure(figsize=(10,2)) plt.plot(t0,y.real,'.',alpha=0.5, label=f'y (n={len(y)})') plt.plot(t,x,'.',alpha=0.5,label=f'x (n={len(x)})') plt.xlabel('time (s)') plt.legend() plt.show()