<jupyter_start><jupyter_text>Solution {-}A common autocorrelation function encountered in physical problems is:\begin{equation*}  R(\tau)=\sigma^2 e^{-\beta |\tau|} \cos \omega_0 \tau\end{equation*}1. Find the corresponding spectral density function\begin{equation*}  S(j\omega)=\frac{\sigma^2 \beta}{(\omega+\omega_0)^2+\beta^2} + \frac{\sigma^2 \beta}{(\omega-\omega_0)^2+\beta^2}\end{equation*}2. Plot the autocorrelation and the spectral density<jupyter_code>from numpy import linspace, exp, cos
import matplotlib.pyplot as plt

sigma = 1
beta = 2
omega0 = 10

tau = linspace(-2, 2, 100)
R = sigma**2*exp(-beta*abs(tau))*cos(omega0*tau)

omega = linspace(-20, 20, 100)
S = sigma**2*beta/((omega + omega0)**2 + beta**2) + sigma**2*beta/((omega - omega0)**2 + beta**2)

# Plot autocorrelation
plt.plot(tau, R)
plt.title("Autocorrelation")
plt.xlabel("Lag")
plt.ylabel("Correlation")
plt.grid()
plt.show()

# Plot spectral density
plt.plot(tau, S)
plt.title("Spectral density")
plt.xlabel("Frequency")
plt.ylabel("Power")
plt.grid()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18808193668528864, 'fraction_numerical': 0.036312849162011177, 'mean_word_length': 5.935483870967742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '156928', 'license': 'MIT', 'n_tokens_mistral': 426, 'n_tokens_neox': 386, 'n_words': 85, 'path': 'Problem 2.9.ipynb', 'repo_name': 'mfkiwl/GMPE340', 'size': '1074'}