I am not getting the desired output, it is cutting off the lower freq. no matter if I set it to 'low' or 'high'.
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
def butter_filter(data, butterCutoffFreq, order=1):
b, a = signal.butter(order, butterCutoffFreq, 'low', analog=True)
y = signal.lfilter(b, a, data)
return y
"""
White noise
"""
N = 1024
dt = np.float64(1)
y = np.random.normal(loc=0.0, scale=1.0, size=N)
t = np.arange(start=0, stop=N, step=dt)
butterCutoffFreq = 0.5 * 1/dt
amps = np.fft.rfft(y)
freqs = np.fft.rfftfreq(y.size, dt)
#plt.plot(freqs, np.abs(amps), color='b')
ampsFiltered = butter_filter(y, butterCutoffFreq)
ampsFiltered = np.fft.rfft(ampsFiltered)
plt.plot(freqs, np.abs(ampsFiltered), color='g')
plt.show()
dt
? IsyWhitenoise
the same asy
? – Dandt
? Maybe random noise at 1Hz intervals doesn't have nice properties. See if changing the frequency to something significantly higher makes the chart appear more low pass? – Dan