@@ -1264,7 +1264,7 @@ def _convertToStateSpace(sys, **kw):
1264
1264
1265
1265
1266
1266
# TODO: add discrete time option
1267
- def _rss_generate (states , inputs , outputs , type ):
1267
+ def _rss_generate (states , inputs , outputs , type , strictly_proper = False ):
1268
1268
"""Generate a random state space.
1269
1269
1270
1270
This does the actual random state space generation expected from rss and
@@ -1374,7 +1374,7 @@ def _rss_generate(states, inputs, outputs, type):
1374
1374
# Apply masks.
1375
1375
B = B * Bmask
1376
1376
C = C * Cmask
1377
- D = D * Dmask
1377
+ D = D * Dmask if not strictly_proper else zeros ( D . shape )
1378
1378
1379
1379
return StateSpace (A , B , C , D )
1380
1380
@@ -1649,7 +1649,7 @@ def tf2ss(*args):
1649
1649
raise ValueError ("Needs 1 or 2 arguments; received %i." % len (args ))
1650
1650
1651
1651
1652
- def rss (states = 1 , outputs = 1 , inputs = 1 ):
1652
+ def rss (states = 1 , outputs = 1 , inputs = 1 , strictly_proper = False ):
1653
1653
"""
1654
1654
Create a stable *continuous* random state space object.
1655
1655
@@ -1661,6 +1661,9 @@ def rss(states=1, outputs=1, inputs=1):
1661
1661
Number of system inputs
1662
1662
outputs : integer
1663
1663
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'.
1664
1667
1665
1668
Returns
1666
1669
-------
@@ -1684,10 +1687,11 @@ def rss(states=1, outputs=1, inputs=1):
1684
1687
1685
1688
"""
1686
1689
1687
- return _rss_generate (states , inputs , outputs , 'c' )
1690
+ return _rss_generate (states , inputs , outputs , 'c' ,
1691
+ strictly_proper = strictly_proper )
1688
1692
1689
1693
1690
- def drss (states = 1 , outputs = 1 , inputs = 1 ):
1694
+ def drss (states = 1 , outputs = 1 , inputs = 1 , strictly_proper = False ):
1691
1695
"""
1692
1696
Create a stable *discrete* random state space object.
1693
1697
@@ -1722,7 +1726,8 @@ def drss(states=1, outputs=1, inputs=1):
1722
1726
1723
1727
"""
1724
1728
1725
- return _rss_generate (states , inputs , outputs , 'd' )
1729
+ return _rss_generate (states , inputs , outputs , 'd' ,
1730
+ strictly_proper = strictly_proper )
1726
1731
1727
1732
1728
1733
def ssdata (sys ):
0 commit comments