11import control as c
2+ from control .xferfcn import clean_tf
3+ from control .statesp import clean_ss
4+ from control .timeresp import fival
25import numpy as np
36
47ci = 2 / np .sqrt (13 )
1417H = c .tf ([[Hq .num [0 ][0 ], Htheta .num [0 ][0 ]], [Hgamma .num [0 ][0 ], Hh .num [0 ][0 ]]],
1518 [[Hq .den [0 ][0 ], Htheta .den [0 ][0 ]], [Hgamma .den [0 ][0 ], Hh .den [0 ][0 ]]])
1619sys1 = c .ss (H )
17- sys1 .D = np .array ([[1 , 2 ], [3 , 4 ]]) # Changes it to a non-zero input matrix D
20+ sys1 .D = np .array ([[1 , 2 ], [3e-13 , 4 ]]) # Changes it to a non-zero input matrix D
1821
1922H = c .tf (sys1 ) # Gives a tf with nice unrounded residual components
2023
2124H2 = c .tf ([1 , - 3 , 0 , 0 ], [1 , 1e-13 , 7 , 0 , 0 , 0 ]) # to test minreal things
2225
23- print (H )
26+ print (H .clean ())
27+ #print(sys1)
28+ #print(H.clean(input = 1, output = 2, precision = 9))
29+ #print(sys1.clean(precision = 12))
30+ #print(clean_tf(sys1, input = 1, output = 2, precision = 1))
31+ #print(clean_tf(H, input = 2, output = 2, precision = 8))
32+ #print(clean_ss(sys1, precision = 2))
33+ #print(clean_ss(H, precision = 12))
34+ print (H .fival (forcing = "step" , input = 1 , output = 1 , stabilityCheck = True ))
35+ print (sys1 .fival (forcing = "step" , input = 2 , stabilityCheck = True , precision = 17 ))
36+ print (fival (H , forcing = "step" , output = 2 , stabilityCheck = True , precision = 3 ))
37+ print (fival (sys1 , forcing = "step" , input = 2 , output = 2 , precision = 10 ))
0 commit comments