@@ -1090,7 +1090,7 @@ def _common_den(self, imag_tol=None, allow_nonproper=False):
10901090
10911091 return num , den , denorder
10921092
1093- def sample (self , Ts , method = 'zoh' , alpha = None , prewarp_frequency = None ,
1093+ def sample (self , Ts , method = 'zoh' , alpha = None , prewarp_frequency = None ,
10941094 name = None , copy_names = True , ** kwargs ):
10951095 """Convert a continuous-time system to discrete time
10961096
@@ -1119,19 +1119,17 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
11191119 time system's magnitude and phase (the gain=1 crossover frequency,
11201120 for example). Should only be specified with method='bilinear' or
11211121 'gbt' with alpha=0.5 and ignored otherwise.
1122- copy_names : bool, Optional
1123- If `copy_names` is True, copy the names of the input signals, output
1124- signals, and states to the sampled system. If `name` is not
1125- specified, the system name is set to the input system name with the
1126- string '_sampled' appended.
11271122 name : string, optional
11281123 Set the name of the sampled system. If not specified and
1129- if `copy ` is `False`, a generic name <sys[id]> is generated
1130- with a unique integer id. If `copy ` is `True`, the new system
1124+ if `copy_names ` is `False`, a generic name <sys[id]> is generated
1125+ with a unique integer id. If `copy_names ` is `True`, the new system
11311126 name is determined by adding the prefix and suffix strings in
11321127 config.defaults['namedio.sampled_system_name_prefix'] and
11331128 config.defaults['namedio.sampled_system_name_suffix'], with the
11341129 default being to add the suffix '$sampled'.
1130+ copy_names : bool, Optional
1131+ If True, copy the names of the input signals, output
1132+ signals, and states to the sampled system.
11351133
11361134 Returns
11371135 -------
@@ -1146,8 +1144,6 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
11461144 information.
11471145 outputs : int, list of str or None, optional
11481146 Description of the system outputs. Same format as `inputs`.
1149- states : int, list of str, or None, optional
1150- Description of the system states. Same format as `inputs`.
11511147
11521148 Notes
11531149 -----
@@ -1178,15 +1174,16 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
11781174 sysd = TransferFunction (numd [0 , :], dend , Ts )
11791175 # copy over the system name, inputs, outputs, and states
11801176 if copy_names :
1177+ sysd ._copy_names (self )
11811178 if name is None :
1182- name = \
1179+ sysd . name = \
11831180 config .defaults ['namedio.sampled_system_name_prefix' ] + \
1184- self .name + \
1181+ sysd .name + \
11851182 config .defaults ['namedio.sampled_system_name_suffix' ]
1186- sysd . _copy_names ( self , name = name )
1187- # pass desired signal names if names were provided
1188- sysd = TransferFunction ( sysd , name = name , ** kwargs )
1189- return sysd
1183+ else :
1184+ sysd . name = name
1185+ # pass desired signal names if names were provided
1186+ return TransferFunction ( sysd , name = name , ** kwargs )
11901187
11911188 def dcgain (self , warn_infinite = False ):
11921189 """Return the zero-frequency (or DC) gain
0 commit comments