import numpy as np
import matplotlib.pyplot as plt
-----------------------------------
Sinal de exemplo
-----------------------------------
sinal = np.asarray([1, 2, 5, 3, 1, 4, 7, 2, 1])
-----------------------------------
Kernel para detectar picos
-----------------------------------
kernel = np.asarray([-1, 2, -1])
-----------------------------------
Convolução
-----------------------------------
saida = np.convolve(sinal, kernel, mode='same')
-----------------------------------
Plot
-----------------------------------
plt.figure(figsize=(10,4))
plt.subplot(1,2,1)
plt.plot(sinal)
plt.title("Sinal original")
plt.subplot(1,2,2)
plt.plot(saida)
plt.title("Resposta do kernel (picos)")
plt.show()