Copyright (C) 2010-2020 Luke Olson
Copyright (C) 2020 Andreas Kloeckner
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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$')