@@ -402,7 +402,7 @@ def era(YY, m, n, nin, nout, r):
402402 raise NotImplementedError ('This function is not implemented yet.' )
403403
404404
405- def markov (* args , ** kwargs ):
405+ def markov (* args , m = None , transpose = False , dt = True , truncate = False ):
406406 """markov(Y, U, [, m])
407407
408408 Calculate the first `m` Markov parameters [D CB CAB ...]
@@ -420,12 +420,12 @@ def markov(*args, **kwargs):
420420 the input data is less than the desired number of Markov parameters (a
421421 warning message is generated in this case).
422422
423- The function can be called with either 1, 2, or 3 arguments:
423+ The function can be called with either 1, 2 or 3 arguments:
424424
425- * ``K, S, E = lqr (response)``
426- * ``K, S, E = lqr (respnose, m)``
427- * ``K, S, E = lqr (Y, U)``
428- * ``K, S, E = lqr (Y, U, m)``
425+ * ``H = markov (response)``
426+ * ``H = markov (respnose, m)``
427+ * ``H = markov (Y, U)``
428+ * ``H = markov (Y, U, m)``
429429
430430 where `response` is an `TimeResponseData` object, and `Y`, `U`, are 1D or 2D
431431 array and m is an integer.
@@ -446,26 +446,20 @@ def markov(*args, **kwargs):
446446 Number of Markov parameters to output. Defaults to len(U).
447447 dt : True of float, optional
448448 True indicates discrete time with unspecified sampling time,
449- positive number is discrete time with specified sampling time.
450- It can be used to scale the markov parameters in order to match
451- the impulse response of this library.
452- Default values is True.
449+ positive number is discrete time with specified sampling time.It
450+ can be used to scale the markov parameters in order to match the
451+ impulse response of this library. Default is True.
453452 truncate : bool, optional
454- Do not use first m equation for least least squares.
455- Default value is False.
453+ Do not use first m equation for least least squares. Default is False.
454+ transpose : bool, optional
455+ Assume that input data is transposed relative to the standard
456+ :ref:`time-series-convention`. For TimeResponseData this parameter
457+ is ignored. Default is False.
456458
457459 Returns
458460 -------
459461 H : ndarray
460462 First m Markov parameters, [D CB CAB ...]
461-
462-
463- Notes
464- -----
465- It works for SISO and MIMO systems.
466-
467- This function does comply with the Python Control Library
468- :ref:`time-series-convention` for representation of time series data.
469463
470464 References
471465 ----------
@@ -494,25 +488,21 @@ def markov(*args, **kwargs):
494488 transpose = args [0 ].transpose
495489 if args [0 ].transpose and not args [0 ].issiso :
496490 Umat , Ymat = np .transpose (Umat ), np .transpose (Ymat )
497- index = 1
491+ if (len (args ) == 2 ):
492+ m = args [1 ]
493+ elif (len (args ) > 2 ):
494+ raise ControlArgument ("too many positional arguments" )
498495 else :
499496 if (len (args ) < 2 ):
500497 raise ControlArgument ("not enough input arguments" )
501- Umat = np .array (args [0 ], ndmin = 2 )
502- Ymat = np .array (args [1 ], ndmin = 2 )
503- transpose = kwargs .pop ('transpose' , False )
498+ Umat = np .array (args [1 ], ndmin = 2 )
499+ Ymat = np .array (args [0 ], ndmin = 2 )
504500 if transpose :
505501 Umat , Ymat = np .transpose (Umat ), np .transpose (Ymat )
506- index = 2
507-
508-
509- if (len (args ) > index ):
510- m = args [index ]
511- else :
512- m = None
513-
514- dt = kwargs .pop ('dt' , True )
515- truncate = kwargs .pop ('truncate' , False )
502+ if (len (args ) == 3 ):
503+ m = args [2 ]
504+ elif (len (args ) > 3 ):
505+ raise ControlArgument ("too many positional arguments" )
516506
517507 # Make sure the number of time points match
518508 if Umat .shape [1 ] != Ymat .shape [1 ]:
0 commit comments