From: <kk...@us...> - 2011-02-08 22:16:20
|
Revision: 79 http://python-control.svn.sourceforge.net/python-control/?rev=79&view=rev Author: kkchen Date: 2011-02-08 22:16:12 +0000 (Tue, 08 Feb 2011) Log Message: ----------- Modified matlab functions impulse and step for keywords. Tests pass. Steven Brunton <sbr...@pr...> Modified Paths: -------------- branches/control-0.4a/src/TestMatlab.py branches/control-0.4a/src/matlab.py Modified: branches/control-0.4a/src/TestMatlab.py =================================================================== --- branches/control-0.4a/src/TestMatlab.py 2011-02-08 22:16:06 UTC (rev 78) +++ branches/control-0.4a/src/TestMatlab.py 2011-02-08 22:16:12 UTC (rev 79) @@ -12,7 +12,7 @@ D = np.matrix("9.") sys = ss(A,B,C,D) t = np.linspace(0, 1, 10) - t, yout = step(sys, t) + t, yout = step(sys, T=t) youttrue = np.matrix("9. 17.6457 24.7072 30.4855 35.2234 39.1165 42.3227 44.9694 47.1599 48.9776") np.testing.assert_array_almost_equal(yout, youttrue,decimal=4) @@ -23,7 +23,7 @@ D = np.matrix("9.") sys = ss(A,B,C,D) t = np.linspace(0, 1, 10) - t, yout = impulse(sys, t) + t, yout = impulse(sys, T=t) youttrue = np.matrix("86. 70.1808 57.3753 46.9975 38.5766 31.7344 26.1668 21.6292 17.9245 14.8945") np.testing.assert_array_almost_equal(yout, youttrue,decimal=4) @@ -35,7 +35,7 @@ sys = ss(A,B,C,D) t = np.linspace(0, 1, 10) x0 = np.matrix(".5; 1.") - t, yout = initial(sys, t, x0) + t, yout = initial(sys, T=t, X0=x0) youttrue = np.matrix("11. 8.1494 5.9361 4.2258 2.9118 1.9092 1.1508 0.5833 0.1645 -0.1391") np.testing.assert_array_almost_equal(yout, youttrue,decimal=4) Modified: branches/control-0.4a/src/matlab.py =================================================================== --- branches/control-0.4a/src/matlab.py 2011-02-08 22:16:06 UTC (rev 78) +++ branches/control-0.4a/src/matlab.py 2011-02-08 22:16:12 UTC (rev 79) @@ -791,7 +791,12 @@ ltiobjs = sys.returnScipySignalLti() ltiobj = ltiobjs[0][0] - return sp.signal.step(ltiobj, **keywords) + out = sp.signal.step(ltiobj, **keywords) + yout = [] + yout.append(np.mat(out[0])) + yout.append(out[1]) + yout = tuple(yout) + return yout # Redefine initial to use lsim2 #! Not yet implemented (uses step for now) @@ -815,7 +820,8 @@ ltiobjs = sys.returnScipySignalLti() ltiobj = ltiobjs[0][0] - return sp.signal.initial(ltiobj, **keywords) + yout = sp.signal.initial(ltiobj, **keywords) + return np.mat(yout) # Redefine impulse to use initial() #! Not yet implemented (uses impulse for now) @@ -839,5 +845,5 @@ ltiobjs = sys.returnScipySignalLti() ltiobj = ltiobjs[0][0] - return sp.signal.impulse(ltiobj, **keywords) - + yout = sp.signal.impulse(ltiobj, **keywords) + return np.mat(yout) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |