@@ -1238,7 +1238,7 @@ def dcgain(self, warn_infinite=False):
1238
1238
"""
1239
1239
return self ._dcgain (warn_infinite )
1240
1240
1241
- def dynamics (self , t , x , u = 0 ):
1241
+ def dynamics (self , t , x , u = None ):
1242
1242
"""Compute the dynamics of the system
1243
1243
1244
1244
Given input `u` and state `x`, returns the dynamics of the state-space
@@ -1274,7 +1274,7 @@ def dynamics(self, t, x, u=0):
1274
1274
x = np .reshape (x , (- 1 , 1 )) # force to a column in case matrix
1275
1275
if np .size (x ) != self .nstates :
1276
1276
raise ValueError ("len(x) must be equal to number of states" )
1277
- if u is 0 :
1277
+ if u is None :
1278
1278
return self .A .dot (x ).reshape ((- 1 ,)) # return as row vector
1279
1279
else : # received t, x, and u, ignore t
1280
1280
u = np .reshape (u , (- 1 , 1 )) # force to a column in case matrix
@@ -1283,7 +1283,7 @@ def dynamics(self, t, x, u=0):
1283
1283
return self .A .dot (x ).reshape ((- 1 ,)) \
1284
1284
+ self .B .dot (u ).reshape ((- 1 ,)) # return as row vector
1285
1285
1286
- def output (self , t , x , u = 0 ):
1286
+ def output (self , t , x , u = None ):
1287
1287
"""Compute the output of the system
1288
1288
1289
1289
Given input `u` and state `x`, returns the output `y` of the
@@ -1317,7 +1317,7 @@ def output(self, t, x, u=0):
1317
1317
if np .size (x ) != self .nstates :
1318
1318
raise ValueError ("len(x) must be equal to number of states" )
1319
1319
1320
- if u is 0 :
1320
+ if u is None :
1321
1321
return self .C .dot (x ).reshape ((- 1 ,)) # return as row vector
1322
1322
else : # received t, x, and u, ignore t
1323
1323
u = np .reshape (u , (- 1 , 1 )) # force to a column in case matrix
0 commit comments