Skip to content

Commit 88951ce

Browse files
committed
rm abs on phase margin
1 parent 987c0ec commit 88951ce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/ControlSystemsBase/src/analysis.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ function sisomargin(sys::LTISystem, w::AbstractVector{<:Real}; full=false, allMa
506506
if !allMargins #Only output the smallest margins
507507
gm, idx = findmin([gm;Inf])
508508
wgm = [wgm;NaN][idx]
509-
pm, idx = findmin([abs.(pm);Inf])
509+
pm, idx = findmin([pm;Inf])
510510
fi = [fi;NaN][idx]
511511
wpm = [wpm;NaN][idx]
512512
if full

lib/ControlSystemsBase/test/test_analysis.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ Lw = freqresp(L, m[1][])[]
245245
@test imag(Lw) 0 atol = 1e-6 # Test definition of gain margin
246246
@test inv(-real(Lw)) m[2][] atol = 1e-6 # Test definition of gain margin
247247

248+
# https://github.com/JuliaControl/ControlSystems.jl/issues/961
249+
P = tf(1,[5, 10.25, 6.25, 1])
250+
w_180, gm, w_c, pm = margin(50P)
251+
@test pm[] -35.1 rtol=1e-2
248252

249253
# RGA
250254
a = 10

0 commit comments

Comments
 (0)