TODO [ex911.0]

../../_images/sphx_glr_fig-solution-exercise-constraints-a-alssm_001.png

Out:

--DUMP--
 └-Alssm : sinusoidal, A: (2, 2), C: (1, 2), label: sine model

--PRINT--
 A =
[[ 0.95105652 -0.30901699]
 [ 0.30901699  0.95105652]]
C =
[[1 0]]

import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks

import lmlib as lm

OMEGA = .1*np.pi # sinusoidal frequency

# ------------ Evaluate ALSSM -------------
js = np.arange(-np.int(0.5*np.pi/OMEGA), np.int(0.5*np.pi/OMEGA)+1) # ALSSM evaluation range

alssm = lm.AlssmSin(omega=OMEGA, rho=1, label='sine model')
x0s = [[1, 0]] # ALSSM initial state vectors for sine
ys = alssm.eval(x0s, js)

# Printing Model to Console
print("--DUMP--\n", alssm.dump_tree())
print("--PRINT--\n", alssm)

# ------------ Plot ALSSM -------------
fig, ax = plt.subplots(1,1, figsize=(4,3))
ax.set_title('ALSSM Evaluation $s_i(x_0)$')
ax.plot(js, ys[0,:,0], '.-', lw=.5, label='$x_0 = '+str(x0s)+'^\mathrm{T}$')
ax.set( xlabel='Evaluation index $i$')

plt.legend()
plt.show()

Total running time of the script: ( 0 minutes 0.127 seconds)

Gallery generated by Sphinx-Gallery