diff --git a/bdsim/blocks/transfers.py b/bdsim/blocks/transfers.py index 769792e..5b6562b 100644 --- a/bdsim/blocks/transfers.py +++ b/bdsim/blocks/transfers.py @@ -295,7 +295,11 @@ def output(self, t, u, x): return list(self.C @ x) def deriv(self, t, u, x): - xd = self.A @ x + self.B @ np.array(u) + # Reshape u and x to (N,1), i.e. column vectors, so + # no problems with broadcasting between A@x and B@u + x = x.reshape(-1, 1) + u = np.array(u).reshape(-1, 1) + xd = self.A @ x + self.B @ u return xd.flatten()