You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the rednoise function does not produce the results desired. Here is a minimal example based on the function.
from scipy.signal import lfilter
import matplotlib.pyplot as plt
import numpy as np
# This should be strongly non-white when g is close to 1
g = 0.9
# standard deviation of the gaussian white noise
a = 1
# Just a short sample to make visual assessment simpler
N = 100
tau = int(np.ceil(-2 / np.log(np.abs(g))))
# Save the noise for comparison
noise = np.random.randn(N + tau, 1) * a
# Apply the filter
yr = lfilter([1, 0], [1, -g], noise)
yr = yr[tau:]
# Compare the two
plt.plot(yr)
plt.plot(noise[tau:])
which produces the attached plot. For some reason the parameters passed to lfilter do not modify the noisy time series in the way that I would have anticipated. I verified that rednoise returns flat spectra, consistent with the white noise being unaltered as in the example.
Am I implementing the rednoise function incorrectly?
The text was updated successfully, but these errors were encountered:
I think the rednoise function does not produce the results desired. Here is a minimal example based on the function.
which produces the attached plot. For some reason the parameters passed to
lfilter
do not modify the noisy time series in the way that I would have anticipated. I verified thatrednoise
returns flat spectra, consistent with the white noise being unaltered as in the example.Am I implementing the
rednoise
function incorrectly?The text was updated successfully, but these errors were encountered: