why does my convolution routine differ from numpy & scipy's?
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)