Skip to content

Commit

Permalink
Merge pull request #70 from ilayn/gh-69
Browse files Browse the repository at this point in the history
BUG: fix transfer_to_state static gain case
  • Loading branch information
ilayn committed Feb 6, 2021
2 parents 90a785b + 937d662 commit 2bfa00f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion harold/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,7 @@ def transfer_to_state(G, output='system'):
if it_is_gain:
A, B, C = (np.empty((0, 0)),)*3
if np.max((m, p)) > 1:
D = np.empty((m, p), dtype=float)
D = np.empty((p, m), dtype=float)
for rows in range(p):
for cols in range(m):
D[rows, cols] = num[rows][cols]/den[rows][cols]
Expand Down
5 changes: 5 additions & 0 deletions harold/tests/test_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ def test_transfer_to_state():
np.sort(TF.poles))
assert TF.zeros.size == 0

# rectengular static gain
gain = np.ones([2, 3])
Gss = transfer_to_state(Transfer(gain))
assert_array_almost_equal(gain, Gss.d)


def test_state_to_transfer():
G = State(-2*np.eye(2), np.eye(2), [[1, -3], [0, 0]], [[0, 1], [-1, 0]])
Expand Down

0 comments on commit 2bfa00f

Please sign in to comment.