@@ -402,7 +402,7 @@ def era(YY, m, n, nin, nout, r):
402
402
raise NotImplementedError ('This function is not implemented yet.' )
403
403
404
404
405
- def markov (* args , ** kwargs ):
405
+ def markov (* args , m = None , transpose = False , dt = True , truncate = False ):
406
406
"""markov(Y, U, [, m])
407
407
408
408
Calculate the first `m` Markov parameters [D CB CAB ...]
@@ -420,12 +420,12 @@ def markov(*args, **kwargs):
420
420
the input data is less than the desired number of Markov parameters (a
421
421
warning message is generated in this case).
422
422
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:
424
424
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)``
429
429
430
430
where `response` is an `TimeResponseData` object, and `Y`, `U`, are 1D or 2D
431
431
array and m is an integer.
@@ -446,26 +446,20 @@ def markov(*args, **kwargs):
446
446
Number of Markov parameters to output. Defaults to len(U).
447
447
dt : True of float, optional
448
448
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.
453
452
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.
456
458
457
459
Returns
458
460
-------
459
461
H : ndarray
460
462
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.
469
463
470
464
References
471
465
----------
@@ -494,25 +488,21 @@ def markov(*args, **kwargs):
494
488
transpose = args [0 ].transpose
495
489
if args [0 ].transpose and not args [0 ].issiso :
496
490
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" )
498
495
else :
499
496
if (len (args ) < 2 ):
500
497
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 )
504
500
if transpose :
505
501
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" )
516
506
517
507
# Make sure the number of time points match
518
508
if Umat .shape [1 ] != Ymat .shape [1 ]:
0 commit comments