Skip to content

Commit 5ebb53b

Browse files
authored
Merge pull request #793 from JuliaControl/analysisdocs
add analysis examples to the docs
2 parents 98435be + a28d942 commit 5ebb53b

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ makedocs(modules=[ControlSystems, ControlSystemsBase],
5454
],
5555
"Examples" => Any[
5656
"Design" => "examples/example.md",
57+
"Analysis" => "examples/analysis.md",
5758
"Smith predictor" => "examples/smith_predictor.md",
5859
"Iterative Learning Control (ILC)" => "examples/ilc.md",
5960
"Properties of delay systems" => "examples/delay_systems.md",

docs/src/examples/analysis.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Analysis of linear control systems
2+
From classical control, we get robustness measures such as gain and phase margins. These provide a quick and intuitive way to assess robustness of single-input, single-output systems, but also have a number of downsides, such as optimism in the presence of simultaneous gain and phase variations as well as limited applicability for MIMO systems.
3+
4+
Gain and phase margins can be computed using the functions [`margin`](@ref) and [`marginplot`](@ref)
5+
6+
## Example: Gain and phase margins
7+
```@example
8+
using ControlSystemsBase, Plots
9+
P = tf(1, [1, 0.2, 1])
10+
C = pid(0.2, 1)
11+
loopgain = P*C
12+
marginplot(loopgain)
13+
```
14+
15+
## Sensitivity analysis
16+
More generally applicable measures of robustness include analysis of sensitivity functions, notably the peaks of the sensitivity function
17+
```math
18+
S(s) = (I + P(s)C(s))^{-1}
19+
```
20+
and the complementary sensitivity function
21+
```math
22+
T(s) = I - S(s) = (I + P(s)C(s))^{-1}P(s)C(s)
23+
```
24+
25+
### Examples
26+
We can plot all four sensitivity functions referred to as the "gang of four" using [`gangoffourplot`](@ref).
27+
```@example SENS
28+
using ControlSystemsBase, Plots
29+
P = tf(1, [1, 0.2, 1])
30+
C = pid(0.2, 1)
31+
gangoffourplot(P, C)
32+
```
33+
34+
The peak value of the sensitivity function, ``M_S``, can be computed using [`hinfnorm`](@ref)
35+
```@example SENS
36+
S = sensitivity(P, C)
37+
Ms, ωMs = hinfnorm(S)
38+
```
39+
40+
And we can plot a circle in the Nyquist plot corresponding to the inverse distance between the loop-transfer function and the critical point:
41+
```@example SENS
42+
w = exp10.(-1:0.001:2)
43+
nyquistplot(P*C, w, Ms_circles=[Ms], xlims=(-1.2, 0.5), ylims=(-2, 0.3))
44+
```
45+
46+
``M_S`` is always ``≥ 1``, but we typically want to keep it below 1.3-2 for robustness reasons. For SISO systems, ``M_S`` is linked to the classical gain and phase margins through the following inequalities:
47+
```math
48+
\begin{aligned}
49+
\phi_m &≥ 2 \sin^{-1}\left(\dfrac{1}{2M_S}\right) \text{rad}\\
50+
g_m &≥ \dfrac{M_S}{M_S-1}
51+
\end{aligned}
52+
```
53+
54+
We can also obtain individual sensitivity function using the low-level function [`feedback`](@ref) directly, or using one of the higher-level functions
55+
- [`sensitivity`](@ref)
56+
- [`comp_sensitivity`](@ref)
57+
- [`G_PS`](@ref)
58+
- [`G_CS`](@ref)
59+
- [`gangoffour`](@ref)
60+
- [`extended_gangoffour`](@ref)
61+
- [`feedback_control`](@ref)
62+
63+
64+
## Further reading
65+
A modern robustness measure is the [`diskmargin`](https://juliacontrol.github.io/RobustAndOptimalControl.jl/dev/#Diskmargin-example), that analyses the robustness of a SISO or MIMO system to simultaneous gain and phase variations.
66+
67+
In the presence of structured uncertainty, such as parameter uncertainty or other explicitly modeled uncertainty, the structured singular value (often referred to as $\mu$), provides a way to analyze robustness with respect to the modeled uncertainty. See the [RobustAndOptimalControl.jl](https://juliacontrol.github.io/RobustAndOptimalControl.jl/dev/) package for more details.

0 commit comments

Comments
 (0)