import sympy
import control as ct
import numpy as np
from sympy import I #imaginary parts
A = np.asarray([
[0, 1, 0],
[0, 0, 1],
[-1, -5, -6]
])
B = np.asarray([
[0],
[0],
[1]
])
k1, k2, k3, s= sympy.symbols('k1 k2 k3 s')
identity_matrix = np.identity(3)
k_matrix = sympy.matrices.dense.MutableDenseMatrix(1,3, [k1, k2, k3])
control_plant = s*identity_matrix-A+B@k_matrix
sympy.det(control_plant)
ce = (s+2-4*I)*(s+2+4*I)*(s+10)
sympy.expand(ce)
k3 + 6 = 14
k2 + 5 = 60
k1 + 1 = 200
%reset -f
import sympy
import control as ct
import numpy as np
from sympy import I #imaginary parts
A = np.asarray([
[0, 1, 0],
[0, 0, 1],
[-1, -5, -6]
])
B = np.asarray([
[0],
[0],
[1]
])
k1, k2, k3, s = sympy.symbols('k1 k2 k3 s')
identity_matrix = np.identity(3)
k_matrix = sympy.matrices.dense.MutableDenseMatrix(1,3, [k1, k2, k3])
#control + plant
# = s@Identity -A +B@K
control_plant = s*identity_matrix - A + B@k_matrix
ce_having_k = sympy.det(control_plant)
ce_having_k
ce = (s+2+I*4)*(s+2-I*4)*(s+10)
ce_polynomial = sympy.expand(ce)
ce_polynomial
k3 + 6 = 14
k2 + 5 = 60
k1 + 1 = 200
계산기로는 못 풀거 같음..
%reset -f
import sympy
import control as ct
import numpy as np
from sympy import I #imaginary parts
A = np.asarray([
[-1, -1, -1],
[1, 0, 0],
[0, 1, 0]
])
B = np.asarray([
[1],
[0],
[0]
])
k1, k2, k3, s = sympy.symbols('k1 k2 k3 s')
identity_matrix = np.identity(3)
k_matrix = sympy.matrices.dense.MutableDenseMatrix(1,3, [k1, k2, k3])
ce_having_k = s*identity_matrix - A + B@k_matrix
ce_having_k
sympy.det(ce_having_k)
ce = (s+1)*(s+2)*(s+3)
sympy.expand(ce)
s^2: 1+k1 = 6
s^1: 1+k2 = 11
s^0: 1+k3 =6
k1 = 5
k2 = 10
k3 = 5