Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lib/ControlSystemsBase/src/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ optionally provided.
`kwargs` is sent as argument to plot.
"""
nyquistplot
@recipe function nyquistplot(p::Nyquistplot; Ms_circles=Float64[], Mt_circles=Float64[], unit_circle=false, hz=false, critical_point=-1, balance=true)
@recipe function nyquistplot(p::Nyquistplot; Ms_circles=Float64[], Mt_circles=Float64[], M_circles=[], unit_circle=false, hz=false, critical_point=-1, balance=true)
systems, w = _processfreqplot(Val{:nyquist}(), p.args...)
ny, nu = size(systems[1])
nw = length(w)
Expand Down Expand Up @@ -445,7 +445,21 @@ nyquistplot
rt = Mt/(Mt^2-1) # Mt radius
ct.+rt.*C, rt.*S
end
end
end
for M in M_circles
@series begin
subplot --> s2i(i,j)
primary := false
linestyle := :dash
linecolor := :gray
seriestype := :path
markershape := :none
label := "M = $(round(M, digits=2))"
ct = -(2M^2 - 2M + 1)/(2M*(M-1)) # M center
rt = (2M - 1)/(2M*(M-1)) # M radius
ct.+rt.*C, rt.*S
end
end
if unit_circle
@series begin
subplot --> s2i(i,j)
Expand Down
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/test/test_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getexamples()
setPlotScale("dB")
bodeplot(sys,ws)
end
nyquistgen() = nyquistplot(sysss,ws, Ms_circles=1.2, Mt_circles=1.2)
nyquistgen() = nyquistplot(sysss,ws, Ms_circles=1.2, Mt_circles=1.2, M_circles=1.2)
sigmagen() = sigmaplot(sysss,ws)
#Only siso for now
nicholsgen() = nicholsplot(tf1,ws)
Expand Down