<jupyter_start><jupyter_text>[Second order system](https://python-control.readthedocs.io/en/0.9.0/secord-matlab.html)<jupyter_code>import os
import matplotlib.pyplot as plt   # MATLAB plotting functions
from control.matlab import *      # MATLAB-like functions

from numpy import linalg as LA    # added by HS for checking eignevalue
# Parameters defining the system
m = 250.0           # system mass
k = 40.0            # spring constant
b = 60.0            # damping constant

# System matrices
A = [[0, 1.], [-k/m, -b/m]]
B = [[0], [1/m]]
C = [[1., 0]]
sys = ss(A, B, C, 0)
eigval, normalized_eigvec = LA.eig(A)
eigval
# Step response for the system
plt.figure(1)
yout, T = step(sys)
plt.plot(T.T, yout.T)
plt.show(block=False)
# Bode plot for the system
plt.figure(2)
mag, phase, om = bode(sys)
#plt.show(block=False)
# Nyquist plot for the system
plt.figure(3)
nyquist(sys)
plt.show(block=False)<jupyter_output><empty_output><jupyter_text>與Matlab上的範例比較![image-2.png](attachment:image-2.png)<jupyter_code># check another case
H = tf([2, 5, 1],[1, 2, 3]);
H
nyquist(H)
plt.show(block=False)<jupyter_output><empty_output><jupyter_text>Matlab result![image.png](attachment:image.png)<jupyter_code># Root lcous plot for the system
rlocus(sys)
plt.show(block=False)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1478927203065134, 'fraction_numerical': 0.02375478927203065, 'mean_word_length': 4.678260869565217, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '351505', 'license': 'MIT', 'n_tokens_mistral': 546, 'n_tokens_neox': 508, 'n_words': 119, 'path': 'Python_Control_Library_01.ipynb', 'repo_name': 'HSJNYCU/Learning', 'size': '1305'}