control.tf2ss()模块在SISO系统上可以完美地工作,但是一旦安装了slycot(对于MIMO系统是必需的),该函数将返回错误(对于SISO和MIMO系统)。
一旦安装了slycot模块,则以下代码
A = numpy.array([[1., -2], [3, -4]])
B = numpy.array([[5.], [7]])
C = numpy.array([[6., 8]])
D = numpy.array([[9.]])
sys1 = control.ss(A, B, C, D)
control.ss2tf(sys1)
返回
ValueError Traceback (most recent call last)
<ipython-input-20-5160baa6cd95> in <module>
4 D = numpy.array([[9.]])
5 sys1 = control.ss(A, B, C, D)
----> 6 control.ss2tf(sys1)
C:\ProgramData\Anaconda3\lib\site-packages\control\xferfcn.py in ss2tf(*args)
1315 sys = args[0]
1316 if isinstance(sys, StateSpace):
-> 1317 return _convertToTransferFunction(sys)
1318 else:
1319 raise TypeError("ss2tf(sys): sys must be a StateSpace object. It \
C:\ProgramData\Anaconda3\lib\site-packages\control\xferfcn.py in _convertToTransferFunction(sys, **kw)
1097 # Make sure to convert system matrices to numpy arrays
1098 tfout = tb04ad(sys.states, sys.inputs, sys.outputs, array(sys.A),
-> 1099 array(sys.B), array(sys.C), array(sys.D), tol1=0.0)
1100
1101 # Preallocate outputs.
C:\ProgramData\Anaconda3\lib\site-packages\slycot\transform.py in tb04ad(n, m, p, A, B, C, D, tol1, tol2, ldwork)
328 e = ValueError(error_text)
329 e.info = out[-1]
--> 330 raise e
331
332 A,B,C,Nr,index,dcoeff,ucoeff = out[:-1]
ValueError: The following argument had an illegal value: A
我在slycot模块上进行了诊断,并获得了以下结果
>>> import slycot
>>> slycot.test("full")
Running unit tests for slycot
NumPy version 1.15.4
NumPy relaxed strides checking option: True
NumPy is installed in C:\ProgramData\Anaconda3\lib\site-packages\numpy
Python version 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
nose version 1.3.7
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_cheevx_work
Wrong parameter 1 in LAPACKE_checon
Wrong parameter 1 in LAPACKE_cheevx_work
Wrong parameter 1 in LAPACKE_cggesx_work
Wrong parameter 1 in LAPACKE_checon
.C:\ProgramData\Anaconda3\lib\site-packages\slycot\tests\test.py:16: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
a = matrix("-2 0.5;-1.6 -5")
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_dpoequ
我显然对LAPACKE有问题,但似乎找不到。
提前感谢您的帮助!