Copyright (C) 2010-2020 Luke Olson
Copyright (C) 2020 Andreas Kloeckner
import numpy as np
import matplotlib.pyplot as plt
Let $j$ be the wave number, then $$ j = \frac{2\pi}{\tilde{\lambda}} $$ where $\tilde{\lambda}$ is the wavelength.
A sinusoidal wave is expressed as $$ A \cos \left( \frac{2 \pi x}{\tilde{\lambda}} \right). $$
kdx = np.linspace(0, np.pi, 20) / np.pi
plt.plot(kdx, np.cos(2*np.pi*kdx / 0.001))
plt.plot(kdx, np.cos(2*np.pi*kdx / 1.0))
[<matplotlib.lines.Line2D at 0x7f981cb08050>]
def ampFTBS(jhx, lmbda):
return np.sqrt(1 - 2 * lmbda * (1 - lmbda) * (1 - np.cos(np.pi*jhx)))
def ampBTCS(jhx, lmbda):
return 1 / np.sqrt(1 + lmbda**2 * np.sin(np.pi * jhx)**2)
jhx = np.linspace(0, np.pi, 100) / np.pi
#lmbdas = [0.1, 0.2, 0.4, 0.8, 0.9, 1.0, 1.2, 1.4, 1.8, 2.0]
lmbdas = [0.1, 0.2, 0.5, 0.6, 0.75, 0.9, 1.1]
for lmbda in lmbdas:
plt.plot(jhx, ampFTBS(jhx, lmbda), label='%g'%lmbda, lw=4)
plt.legend()
plt.xlabel('$j h_x / \pi$', fontsize=24)
plt.ylabel('$|s(j)|$', fontsize=24)
Text(0, 0.5, '$|s(j)|$')
def alphaoverj(jhx, lmbda):
return np.arctan((lmbda * np.sin(np.pi*jhx)) / (1 - lmbda + lmbda*np.cos(np.pi*jhx))) / (lmbda * np.pi * jhx)
jhx = np.linspace(0, np.pi, 100) / np.pi
#lmbdas = [0.1, 0.2, 0.4, 0.8, 0.9, 1.0, 1.2, 1.4, 1.8, 2.0]
lmbdas = [0.25, .33, 0.88]
for lmbda in lmbdas:
plt.plot(jhx, alphaoverj(jhx, lmbda), label='%g' % lmbda)
plt.legend()
plt.xlabel('$j h_x / \pi$', fontsize=24)
/home/andreas/src/env-3.7/lib/python3.7/site-packages/ipykernel_launcher.py:2: RuntimeWarning: invalid value encountered in true_divide
Text(0.5, 0, '$j h_x / \\pi$')