Skip to content

Commit 815ca2d

Browse files
committed
further attempts at fixing
1 parent f309232 commit 815ca2d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

control/margins.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ def stability_margins(sysdata, returnall=False, epsw=1e-10):
130130
sys = sysdata
131131
elif getattr(sysdata, '__iter__', False) and len(sysdata) == 3:
132132
mag, phase, omega = sysdata
133-
sys = frdata.FRD(mag * np.exp(1j * phase * np.pi/180), omega,
134-
smooth=True)
133+
sys = frdata.FRD(mag * np.exp(1j * phase * np.pi/180),
134+
omega, smooth=True)
135135
else:
136136
sys = xferfcn._convertToTransferFunction(sysdata)
137137
except Exception as e:
@@ -227,9 +227,10 @@ def dstab(w):
227227
widx = np.where(np.diff(np.sign(np.diff(dstab(sys.omega)))))[0]
228228
wstab = np.array(
229229
[ sp.optimize.minimize_scalar(
230-
dstab, bracket=(sys.omega[i], sys.omega[i+1]))
230+
dstab, bracket=(sys.omega[i], sys.omega[i+1])).x
231231
for i in widx if i+1 < len(sys.omega) and
232232
np.diff(np.diff(dstab(sys.omega[i-1:i+2])))[0] < 0 ])
233+
print (wstab)
233234

234235
# there is really only one stab margin; the closest
235236
#res = sp.optimize.minimize_scalar(

0 commit comments

Comments
 (0)