from scipy.io import loadmat
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import spectrogramAnalyzing Rhythms Part 2a (Autocovariance)
Load modules we’ll need.
Make the noise signal.
N = 1000;
dt= 0.001;
T = "SOMETHING"
x = "SOMETHING"
t = "SOMETHING"
plt.plot(t,x)
plt.xlabel('Time [s]');Compute the auto-covariance.
ac_xx = "SOMETHING"
lags = "SOMETHING" # Create a lag axis,
plt.plot(lags, ac_xx) # ... and plot the result.
plt.xlabel('Lag [s]')
plt.ylabel('Autocovariance');Compute the spectrum.
Xf = np.fft.fft(x - x.mean()) # Compute Fourier transform of x
# Compute the spectrum
Sxx = "SOMETHING"
# Define a frequency axis.
f = np.fft.fftfreq(N, dt)
# Plot the result.
plt.plot(f, Sxx)