Skip to content

Commit 5434318

Browse files
authored
Merge pull request #588 from bnavigator/timeresp-doc
improve forced_response and its documentation
2 parents de87cc6 + a8b72f5 commit 5434318

File tree

4 files changed

+416
-381
lines changed

4 files changed

+416
-381
lines changed

control/tests/modelsimp_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ def testMarkovSignature(self, matarrayout, matarrayin):
6565
markov(Y, U, m)
6666

6767
# Make sure markov() returns the right answer
68-
# forced response can return wrong shape until gh-488 is merged
69-
@pytest.mark.xfail
7068
@pytest.mark.parametrize("k, m, n",
7169
[(2, 2, 2),
7270
(2, 5, 5),
@@ -81,7 +79,7 @@ def testMarkovResults(self, k, m, n):
8179
# m = number of Markov parameters
8280
# n = size of the data vector
8381
#
84-
# Values should match exactly for n = m, otherewise you get a
82+
# Values *should* match exactly for n = m, otherewise you get a
8583
# close match but errors due to the assumption that C A^k B =
8684
# 0 for k > m-2 (see modelsimp.py).
8785
#
@@ -108,7 +106,10 @@ def testMarkovResults(self, k, m, n):
108106
Mcomp = markov(Y, U, m)
109107

110108
# Compare to results from markov()
111-
np.testing.assert_array_almost_equal(Mtrue, Mcomp)
109+
# experimentally determined probability to get non matching results
110+
# with rtot=1e-6 and atol=1e-8 due to numerical errors
111+
# for k=5, m=n=10: 0.015 %
112+
np.testing.assert_allclose(Mtrue, Mcomp, rtol=1e-6, atol=1e-8)
112113

113114
def testModredMatchDC(self, matarrayin):
114115
#balanced realization computed in matlab for the transfer function:
@@ -219,4 +220,3 @@ def testBalredMatchDC(self, matarrayin):
219220
np.testing.assert_array_almost_equal(rsys.B, Brtrue, decimal=4)
220221
np.testing.assert_array_almost_equal(rsys.C, Crtrue, decimal=4)
221222
np.testing.assert_array_almost_equal(rsys.D, Drtrue, decimal=4)
222-

0 commit comments

Comments
 (0)