Skip to content

Commit b3eab3d

Browse files
committed
add docstrings
1 parent a96837f commit b3eab3d

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/diskmargin.jl

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ function Disk(; α, σ)
117117
end
118118

119119
Disk(dm::Diskmargin) = Disk(dm.γmin, dm.γmax)
120+
121+
"""
122+
nyquist(d::Disk)
123+
124+
Transform a `Disk` representing a diskmargin to a exclusion disk in the Nyquist plane. This can be useful for visualizing a diskmargin in the Nyquist plane.
125+
"""
120126
ControlSystems.nyquist(d::Disk) = Disk(-inv(d.γmin), -inv(d.γmax)) # translate the disk to a nyquist exclusion disk
121127

122128
"""
@@ -133,14 +139,7 @@ The margins are aviable as fields of the returned objects, see [`Diskmargin`](@r
133139
134140
# Arguments:
135141
- `L`: A loop-transfer function.
136-
- `σ`: If little is known about the distribution of gain variations then σ = 0
137-
is a reasonable choice as it allows for a gain increase or decrease by the same relative amount.
138-
The choice σ < 0 is justified if the gain can decrease by a larger factor than it can increase.
139-
Similarly, the choice σ > 0 is justified when the gain can increase by a larger factor than it can
140-
decrease.
141-
If σ = −1 then the disk margin condition is αmax = inv(MT). This margin is related to the robust
142-
stability condition for models with multiplicative uncertainty of the form P (1 + δ).
143-
If σ = +1 then the disk margin condition is αmax = inv(MS)
142+
- `σ`: If little is known about the distribution of gain variations then σ = 0 is a reasonable choice as it allows for a gain increase or decrease by the same relative amount. *The choice σ < 0* is justified if the gain can decrease by a larger factor than it can increase. Similarly, *the choice σ > 0* is justified when the gain can increase by a larger factor than it can decrease. *If σ = −1* then the disk margin condition is αmax = inv(MT). This margin is related to the robust stability condition for models with multiplicative uncertainty of the form P (1 + δ). If σ = +1 then the disk margin condition is αmax = inv(MS)
144143
- `kwargs`: Are sent to the [`hinfnorm`](@ref) calculation
145144
- `ω`: If a vector of frequencies is supplied, the frequency-dependent disk margin will be computed, see example below.
146145
@@ -167,6 +166,11 @@ function diskmargin(L::LTISystem, σ::Real=0; kwargs...)
167166
diskmargin(L, σ, ω0)
168167
end
169168

169+
"""
170+
diskmargin(L::LTISystem, σ::Real, ω)
171+
172+
Calculate the diskmargin at a particular frequency or vector of frequencies. If `ω` is a vector, you get a frequency-dependent diskmargin plot if you plot the returned value.
173+
"""
170174
diskmargin(L::LTISystem, σ::Real, ω::AbstractArray) = map(w->diskmargin(L, σ, w), ω)
171175

172176
function diskmargin(L::LTISystem, σ::Real, ω0::Real)
@@ -192,6 +196,13 @@ end
192196

193197
γϕcurve(dm::Diskmargin; kwargs...) = γϕcurve(dm.α, dm.σ; kwargs...)
194198

199+
"""
200+
γϕcurve(α, σ; N = 200)
201+
202+
Internal function. Get the curve of extremal stable gain and phase perturbations. This function is called with a single diskmargin object is plotted.
203+
204+
- `N`: Number of points on the curve.
205+
"""
195206
function γϕcurve(α, σ; N = 200)
196207
θ = LinRange(0, π, N)
197208
f = @. (2 - α*cis(θ)*(1-σ)) / (2 + α*cis(θ)*(1+σ))

0 commit comments

Comments
 (0)