From: <mur...@us...> - 2012-11-11 02:49:36
|
Revision: 241 http://sourceforge.net/p/python-control/code/241 Author: murrayrm Date: 2012-11-11 02:49:33 +0000 (Sun, 11 Nov 2012) Log Message: ----------- Fixed bugs in various calculations and orders of indices. Modified Paths: -------------- branches/rmm-trajgen/examples/doubleint.py branches/rmm-trajgen/trajgen/flatsys.py branches/rmm-trajgen/trajgen/poly.py trunk/src/lti.py Modified: branches/rmm-trajgen/examples/doubleint.py =================================================================== --- branches/rmm-trajgen/examples/doubleint.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/examples/doubleint.py 2012-11-11 02:49:33 UTC (rev 241) @@ -17,5 +17,6 @@ # Find a trajectory xd, ud = tg.linear_point_to_point(sys1, x0, xf, 1) +print(xd) # Plot the trajectory Modified: branches/rmm-trajgen/trajgen/flatsys.py =================================================================== --- branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 02:49:33 UTC (rev 241) @@ -80,7 +80,7 @@ # least squares solution for now. # #! TODO: need to allow cost and constraints... - alpha = np.linalg.pinv(M) * np.vstack((zflag_T0, zflag_Tf)) + alpha = np.dot(np.linalg.pinv(M), np.vstack((zflag_T0, zflag_Tf))) # # Transform the trajectory from flat outputs to states and inputs Modified: branches/rmm-trajgen/trajgen/poly.py =================================================================== --- branches/rmm-trajgen/trajgen/poly.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/trajgen/poly.py 2012-11-11 02:49:33 UTC (rev 241) @@ -14,4 +14,4 @@ # Compute the kth derivative of the ith basis function at time t def eval_deriv(self, i, k, t): if (i < k): return 0; # higher derivative than power - return sp.misc.factorial(k) * np.power(t, i-k) + return sp.misc.factorial(i)/sp.misc.factorial(i-k) * np.power(t, i-k) Modified: trunk/src/lti.py =================================================================== --- trunk/src/lti.py 2012-11-11 01:28:03 UTC (rev 240) +++ trunk/src/lti.py 2012-11-11 02:49:33 UTC (rev 241) @@ -64,6 +64,16 @@ self.outputs = outputs self.dt = dt +# Test to see if a system is SISO +def issiso(sys, strict=False): + if isinstance(sys, (int, float, complex)) and not strict: + return True + elif not isinstance(sys, Lti): + raise ValueError("Object is not an Lti system") + + # Done with the tricky stuff... + return sys.inputs == 1 and sys.outputs == 1 + # Return the timebase (with conversion if unspecified) def timebase(sys, strict=True): """Return the timebase for an Lti system |