🌐 AI搜索 & 代理 主页
Skip to content

Commit 2745b12

Browse files
authored
Merge pull request #1163 from murrayrm/fix_optimal-03Jul2024
Fix CI errors in NumPy 2.3.1
2 parents aa92b65 + a359e8b commit 2745b12

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

control/optimal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ def _compute_states_inputs(self, coeffs):
746746
states = self.last_states
747747
else:
748748
states = self._simulate_states(self.x, inputs)
749-
self.last_x = self.x
750-
self.last_states = states
751-
self.last_coeffs = coeffs
749+
self.last_x = self.x.copy() # save initial state
750+
self.last_states = states # always a new object
751+
self.last_coeffs = coeffs.copy() # save coefficients
752752

753753
return states, inputs
754754

control/xferfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ def _c2d_matched(sysC, Ts, **kwargs):
13501350
zpoles[idx] = z
13511351
pregainden[idx] = 1 - z
13521352
zgain = np.multiply.reduce(pregainnum) / np.multiply.reduce(pregainden)
1353-
gain = sysC.dcgain() / zgain
1353+
gain = sysC.dcgain() / zgain.real
13541354
sysDnum, sysDden = zpk2tf(zzeros, zpoles, gain)
13551355
return TransferFunction(sysDnum, sysDden, Ts, **kwargs)
13561356

0 commit comments

Comments
 (0)