@@ -1264,7 +1264,7 @@ def _convertToStateSpace(sys, **kw):
12641264
12651265
12661266# TODO: add discrete time option
1267- def _rss_generate (states , inputs , outputs , type ):
1267+ def _rss_generate (states , inputs , outputs , type , strictly_proper = False ):
12681268 """Generate a random state space.
12691269
12701270 This does the actual random state space generation expected from rss and
@@ -1374,7 +1374,7 @@ def _rss_generate(states, inputs, outputs, type):
13741374 # Apply masks.
13751375 B = B * Bmask
13761376 C = C * Cmask
1377- D = D * Dmask
1377+ D = D * Dmask if not strictly_proper else zeros ( D . shape )
13781378
13791379 return StateSpace (A , B , C , D )
13801380
@@ -1649,7 +1649,7 @@ def tf2ss(*args):
16491649 raise ValueError ("Needs 1 or 2 arguments; received %i." % len (args ))
16501650
16511651
1652- def rss (states = 1 , outputs = 1 , inputs = 1 ):
1652+ def rss (states = 1 , outputs = 1 , inputs = 1 , strictly_proper = False ):
16531653 """
16541654 Create a stable *continuous* random state space object.
16551655
@@ -1661,6 +1661,9 @@ def rss(states=1, outputs=1, inputs=1):
16611661 Number of system inputs
16621662 outputs : integer
16631663 Number of system outputs
1664+ strictly_proper : bool, optional
1665+ If set to 'True', returns a proper system (no direct term). Default
1666+ value is 'False'.
16641667
16651668 Returns
16661669 -------
@@ -1684,10 +1687,11 @@ def rss(states=1, outputs=1, inputs=1):
16841687
16851688 """
16861689
1687- return _rss_generate (states , inputs , outputs , 'c' )
1690+ return _rss_generate (states , inputs , outputs , 'c' ,
1691+ strictly_proper = strictly_proper )
16881692
16891693
1690- def drss (states = 1 , outputs = 1 , inputs = 1 ):
1694+ def drss (states = 1 , outputs = 1 , inputs = 1 , strictly_proper = False ):
16911695 """
16921696 Create a stable *discrete* random state space object.
16931697
@@ -1722,7 +1726,8 @@ def drss(states=1, outputs=1, inputs=1):
17221726
17231727 """
17241728
1725- return _rss_generate (states , inputs , outputs , 'd' )
1729+ return _rss_generate (states , inputs , outputs , 'd' ,
1730+ strictly_proper = strictly_proper )
17261731
17271732
17281733def ssdata (sys ):
0 commit comments