Merge pull request #765 from murrayrm/matlab.lsim-24Aug2022 · python-control/python-control@59aeceb

@@ -208,7 +208,6 @@ def testStep(self, siso):

208208

np.testing.assert_array_almost_equal(yout, youttrue, decimal=4)

209209

np.testing.assert_array_almost_equal(tout, t)

210210211-

@slycotonly

212211

def testStep_mimo(self, mimo):

213212

"""Test step for MIMO system"""

214213

sys = mimo.ss1

@@ -267,7 +266,6 @@ def testImpulse(self, siso):

267266

np.testing.assert_array_almost_equal(yout, youttrue, decimal=4)

268267

np.testing.assert_array_almost_equal(tout, t)

269268270-

@slycotonly

271269

def testImpulse_mimo(self, mimo):

272270

"""Test impulse() for MIMO system"""

273271

t = np.linspace(0, 1, 10)

@@ -296,7 +294,6 @@ def testInitial(self, siso):

296294

np.testing.assert_array_almost_equal(yout, youttrue, decimal=4)

297295

np.testing.assert_array_almost_equal(tout, t)

298296299-

@slycotonly

300297

def testInitial_mimo(self, mimo):

301298

"""Test initial() for MIMO system"""

302299

t = np.linspace(0, 1, 10)

@@ -333,7 +330,6 @@ def testLsim(self, siso):

333330

yout, _t, _xout = lsim(siso.ss1, u, t, x0)

334331

np.testing.assert_array_almost_equal(yout, youttrue, decimal=4)

335332336-

@slycotonly

337333

def testLsim_mimo(self, mimo):

338334

"""Test lsim() for MIMO system.

339335

@@ -352,6 +348,25 @@ def testLsim_mimo(self, mimo):

352348

yout, _t, _xout = lsim(mimo.ss1, u, t, x0)

353349

np.testing.assert_array_almost_equal(yout, youttrue, decimal=4)

354350351+

def test_lsim_mimo_dtime(self):

352+

# https://github.com/python-control/python-control/issues/764

353+

time = np.linspace(0.0, 511.0e-6, 512)

354+

DAC = np.sin(time)

355+

ADC = np.cos(time)

356+357+

input_Kalman = np.transpose(

358+

np.concatenate(([[DAC]], [[ADC]]), axis=1)[0])

359+

Af = [[0.45768416, -0.42025511], [-0.43354791, 0.51961178]]

360+

Bf = [[2.84368641, 52.05922305], [-1.47286557, -19.94861943]]

361+

Cf = [[1.0, 0.0], [0.0, 1.0]]

362+

Df = [[0.0, 0.0], [0.0, 0.0]]

363+364+

ss_Kalman = ss(Af, Bf, Cf, Df, 1.0e-6)

365+

y_est, t, x_est = lsim(ss_Kalman, input_Kalman, time)

366+

assert y_est.shape == (time.size, ss_Kalman.ninputs)

367+

assert t.shape == (time.size, )

368+

assert x_est.shape == (time.size, ss_Kalman.nstates)

369+355370

def testMargin(self, siso):

356371

"""Test margin()"""

357372

#! TODO: check results to make sure they are OK

@@ -582,7 +597,6 @@ def testSISOssdata(self, siso):

582597

for i in range(len(ssdata_1)):

583598

np.testing.assert_array_almost_equal(ssdata_1[i], ssdata_2[i])

584599585-

@slycotonly

586600

def testMIMOssdata(self, mimo):

587601

"""Test ssdata() MIMO"""

588602

m = (mimo.ss1.A, mimo.ss1.B, mimo.ss1.C, mimo.ss1.D)