import matplotlib.pyplot as plt
from dtk.bicycle import (benchmark_matrices,
                         benchmark_state_space_vs_speed)
from dtk.control import (eig_of_series, sort_modes,
                         plot_root_locus_components)

M, C1, K0, K2 = benchmark_matrices()
v, A, B = benchmark_state_space_vs_speed(M, C1, K0, K2)
evals, evecs = sort_modes(*eig_of_series(A))
fig, ax = plt.subplots(layout='constrained')
plot_root_locus_components(v, evals, parName='Speed',
                           parUnits='[m/s]', ax=ax)