Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

using ControlSystemsBase, PlutoUI, Plots
4.4 s

Bode primitives demo

md"""# Bode primitives demo"""
2.4 ms

Type 2 terms

Recall that the Type 2 terms look like:

$$\left( 1 + j \omega \tau \right)^{ \pm 1} $$

The slider below allows you to change $\tau$ while the checkbox lets you change the sign of the exponent.

Change $\tau$: 0.01

Flip sign:

md"""## Type 2 terms
Recall that the Type 2 terms look like:

```math
\left( 1 + j \omega \tau \right)^{ \pm 1}
```

The slider below allows you to change $\tau$ while the checkbox lets you change the sign of the exponent.

Change $\tau$: $(@bind τ_2 Slider(0.01:0.01:10, show_value=true))

Flip sign: $(@bind inv_typ2 CheckBox(default=true))
"""
191 ms
begin
type2_numerator = [1]
type2_denominator = [τ_2, 1]
type2_sys_inv = tf(type2_denominator, type2_numerator)
w = 10 .^ range(-2,3,length=1000)
# typ2sys(w) = 1/(1+τ_2*w*im)
# plot(w, angle.(typ2sys.(w)), xaxis=:log)
type2_sys_plot = inv_typ2 ? type2_sys_inv : type2_sys
typ2pp = bodeplot(type2_sys_plot, w, label=false, xlim=(0.01, 1000));
typ2mag = plot!(typ2pp[1], ylim=(0.001, 10000))
typ2mag = vline!(typ2mag, [1/τ_2], label=false)
typ2pha = vline!(typ2pp[2], [1/τ_2], label=false, ylim=(-90, 90))
typ2pha = hline!(typ2pp[2], [inv_typ2 ? 45 : -45], label=false)
end
3.4 s

Type 3 terms

Recall that Type 3 terms are of the form:

$$\left[ \left( \dfrac{j\omega}{\omega_n} \right)^2 + 2 \zeta \left( \dfrac{j\omega}{\omega_n} \right) + 1 \right] ^{\pm n}$$

Here we get to vary $\omega_n$ and $\zeta$.

Change $\zeta$: 0.01

Change $\omega_n$: 0.5

md""" ## Type 3 terms
Recall that Type 3 terms are of the form:

```math
\left[ \left( \dfrac{j\omega}{\omega_n} \right)^2 + 2 \zeta \left( \dfrac{j\omega}{\omega_n} \right) + 1 \right] ^{\pm n}
```

Here we get to vary $\omega_n$ and $\zeta$.

Change $\zeta$: $(@bind ζ Slider(0.01:0.01:0.5, show_value=true))

Change $\omega_n$: $(@bind ω Slider(0.5:0.01:50, show_value=true))
"""
2.0 ms
begin
type3_numerator = [1]
type3_denominator = [1/ω^2, 2*ζ/ω, 1]
type3_sys_plot = inv_typ2 ? typ3sys_inv : typ3sys
typ3pp = bodeplot(type3_sys_plot, w, label=false, xlim=(0.01, 1000));
end
30.1 ms