Last active
August 29, 2015 14:18
-
-
Save kastnerkyle/aa65cafe5e19ab84f621 to your computer and use it in GitHub Desktop.
Super crude filtering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Kyle Kastner | |
# License: BSD 3-clause | |
import numpy as np | |
from scipy.signal import lfilter | |
import matplotlib.pyplot as plt | |
sine = np.sin(np.linspace(-4 * np.pi, 4 * np.pi, 10000)) | |
noise = 0.2 * np.random.randn(len(sine)) | |
s = sine + noise | |
plt.plot(s) | |
plt.figure() | |
low_pass = [1, 1] * 128 | |
plt.plot(lfilter(low_pass, [1], s)) | |
plt.figure() | |
high_pass = [1, -1] * 128 | |
plt.plot(lfilter(high_pass, [1], s)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment