# Evaluation of an ALSSM [ex910.0]¶

Out:

--DUMP--
└-Alssm : polynomial, A: (3, 3), C: (1, 3), label: 2nd order

--PRINT--
A =
[[1 1 1]
[0 1 2]
[0 0 1]]
C =
[[1 0 0]]


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

import lmlib as lm

# ------------ Evaluate ALSSM -------------
js = np.arange(-20, 20) # ALSSM evaluation range

alssm = lm.AlssmPoly(poly_degree=1,label='1th order')
x0s1 = [[-1, 2]] # ALSSM initial state vectors
ys1 = alssm.eval(x0s1, js)

alssm = lm.AlssmPoly(poly_degree=2,label='2nd order')
x0s2 = [[-1, 2, .1]] # ALSSM initial state vectors
ys2 = alssm.eval(x0s2, 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('Polynomial ALSSM Evaluation $s_i(x_0)$')
ax.plot(js, ys1[0,:,:], '.-', lw=.5, label='$x_0 = '+str(x0s1)+'^\mathrm{T}$')
ax.plot(js, ys2[0,:,:], '.-', lw=.5, c='k', label='$x_0 = '+str(x0s2)+'^\mathrm{T}$')
ax.set( xlabel='Evaluation index $i$')

plt.legend()
plt.show()


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

Gallery generated by Sphinx-Gallery