@@ -405,52 +405,52 @@ def era(YY, m, n, nin, nout, r):
405405def markov (* args , m = None , transpose = False , dt = True , truncate = False ):
406406 """markov(Y, U, [, m])
407407
408- Calculate the first `m` Markov parameters [D CB CAB ...]
409- from data
408+ Calculate the first `m` Markov parameters [D CB CAB ...] from data.
410409
411- This function computes the Markov parameters for a discrete time system
410+ This function computes the Markov parameters for a discrete time
411+ system
412412
413413 .. math::
414414
415415 x[k+1] &= A x[k] + B u[k] \\ \\
416416 y[k] &= C x[k] + D u[k]
417417
418- given data for u and y. The algorithm assumes that that C A^k B = 0 for
419- k > m-2 (see [1]_). Note that the problem is ill-posed if the length of
420- the input data is less than the desired number of Markov parameters (a
421- warning message is generated in this case).
418+ given data for u and y. The algorithm assumes that that C A^k B = 0
419+ for k > m-2 (see [1]_). Note that the problem is ill-posed if the
420+ length of the input data is less than the desired number of Markov
421+ parameters (a warning message is generated in this case).
422422
423423 The function can be called with either 1, 2 or 3 arguments:
424424
425- * ``H = markov(response )``
426- * ``H = markov(respnose , m)``
425+ * ``H = markov(data )``
426+ * ``H = markov(data , m)``
427427 * ``H = markov(Y, U)``
428428 * ``H = markov(Y, U, m)``
429429
430- where `response ` is an `TimeResponseData` object, and `Y`, `U`, are 1D or 2D
431- array and m is an integer.
430+ where `data ` is a `TimeResponseData` object, `YY` is a 1D or 3D
431+ array, and r is an integer.
432432
433433 Parameters
434434 ----------
435435 Y : array_like
436- Output data. If the array is 1D, the system is assumed to be single
437- input. If the array is 2D and transpose=False, the columns of `Y`
438- are taken as time points, otherwise the rows of `Y` are taken as
439- time points.
436+ Output data. If the array is 1D, the system is assumed to be
437+ single input. If the array is 2D and transpose=False, the columns
438+ of `Y` are taken as time points, otherwise the rows of `Y` are
439+ taken as time points.
440440 U : array_like
441441 Input data, arranged in the same way as `Y`.
442442 data : TimeResponseData
443443 Response data from which the Markov parameters where estimated.
444444 Input and output data must be 1D or 2D array.
445445 m : int, optional
446- Number of Markov parameters to output. Defaults to len(U).
446+ Number of Markov parameters to output. Defaults to len(U).
447447 dt : True of float, optional
448- True indicates discrete time with unspecified sampling time,
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.
448+ True indicates discrete time with unspecified sampling time and a
449+ positive float is discrete time with the specified sampling time.
450+ It can be used to scale the Markov parameters in order to match
451+ the unit-area impulse response of python-control . Default is True.
452452 truncate : bool, optional
453- Do not use first m equation for least least squares. Default is False.
453+ Do not use first m equation for least squares. Default is False.
454454 transpose : bool, optional
455455 Assume that input data is transposed relative to the standard
456456 :ref:`time-series-convention`. For TimeResponseData this parameter
@@ -459,7 +459,7 @@ def markov(*args, m=None, transpose=False, dt=True, truncate=False):
459459 Returns
460460 -------
461461 H : ndarray
462- First m Markov parameters, [D CB CAB ...]
462+ First m Markov parameters, [D CB CAB ...].
463463
464464 References
465465 ----------
@@ -476,10 +476,10 @@ def markov(*args, m=None, transpose=False, dt=True, truncate=False):
476476 >>> H = ct.markov(Y, U, 3, transpose=False)
477477
478478 """
479- # Convert input parameters to 2D arrays (if they aren't already)
480479
480+ # Convert input parameters to 2D arrays (if they aren't already)
481481 # Get the system description
482- if ( len (args ) < 1 ) :
482+ if len (args ) < 1 :
483483 raise ControlArgument ("not enough input arguments" )
484484
485485 if isinstance (args [0 ], TimeResponseData ):
@@ -488,20 +488,20 @@ def markov(*args, m=None, transpose=False, dt=True, truncate=False):
488488 transpose = args [0 ].transpose
489489 if args [0 ].transpose and not args [0 ].issiso :
490490 Umat , Ymat = np .transpose (Umat ), np .transpose (Ymat )
491- if ( len (args ) == 2 ) :
491+ if len (args ) == 2 :
492492 m = args [1 ]
493- elif ( len (args ) > 2 ) :
493+ elif len (args ) > 2 :
494494 raise ControlArgument ("too many positional arguments" )
495495 else :
496- if ( len (args ) < 2 ) :
496+ if len (args ) < 2 :
497497 raise ControlArgument ("not enough input arguments" )
498498 Umat = np .array (args [1 ], ndmin = 2 )
499499 Ymat = np .array (args [0 ], ndmin = 2 )
500500 if transpose :
501501 Umat , Ymat = np .transpose (Umat ), np .transpose (Ymat )
502- if ( len (args ) == 3 ) :
502+ if len (args ) == 3 :
503503 m = args [2 ]
504- elif ( len (args ) > 3 ) :
504+ elif len (args ) > 3 :
505505 raise ControlArgument ("too many positional arguments" )
506506
507507 # Make sure the number of time points match
@@ -577,6 +577,7 @@ def markov(*args, m=None, transpose=False, dt=True, truncate=False):
577577 H = H .reshape (q ,m ,p ) # output, time*input -> output, time, input
578578 H = H .transpose (0 ,2 ,1 ) # output, input, time
579579
580+ # for siso return a 1D array instead of a 3D array
580581 if q == 1 and p == 1 :
581582 H = np .squeeze (H )
582583
0 commit comments