Skip to content

Commit

Permalink
Merge pull request #588 from bnavigator/timeresp-doc
Browse files Browse the repository at this point in the history
improve forced_response and its documentation
  • Loading branch information
bnavigator committed Apr 2, 2021
2 parents de87cc6 + a8b72f5 commit 5434318
Show file tree
Hide file tree
Showing 4 changed files with 416 additions and 381 deletions.
10 changes: 5 additions & 5 deletions control/tests/modelsimp_test.py
Expand Up @@ -65,8 +65,6 @@ def testMarkovSignature(self, matarrayout, matarrayin):
markov(Y, U, m)

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

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

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

0 comments on commit 5434318

Please sign in to comment.