diff --git a/control/optimal.py b/control/optimal.py index 3242ac3fb..6b60c5b25 100644 --- a/control/optimal.py +++ b/control/optimal.py @@ -746,9 +746,9 @@ def _compute_states_inputs(self, coeffs): states = self.last_states else: states = self._simulate_states(self.x, inputs) - self.last_x = self.x - self.last_states = states - self.last_coeffs = coeffs + self.last_x = self.x.copy() # save initial state + self.last_states = states # always a new object + self.last_coeffs = coeffs.copy() # save coefficients return states, inputs diff --git a/control/xferfcn.py b/control/xferfcn.py index 02ba72df4..8e51534d7 100644 --- a/control/xferfcn.py +++ b/control/xferfcn.py @@ -1350,7 +1350,7 @@ def _c2d_matched(sysC, Ts, **kwargs): zpoles[idx] = z pregainden[idx] = 1 - z zgain = np.multiply.reduce(pregainnum) / np.multiply.reduce(pregainden) - gain = sysC.dcgain() / zgain + gain = sysC.dcgain() / zgain.real sysDnum, sysDden = zpk2tf(zzeros, zpoles, gain) return TransferFunction(sysDnum, sysDden, Ts, **kwargs)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: