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 Plots, ControlSystemsBase, Plots.Measures, PlutoUI
4.6 s

Inverse Bode plots

Based on the figures below estimate the transfer function(s) that could have generated them.

Problem 1

md"""## Inverse Bode plots

Based on the figures below estimate the transfer function(s) that could have generated them.

#### Problem 1
"""
2.4 ms

Draw asymptotes:

md"""Draw asymptotes: $(@bind p1_asymptotes CheckBox(default=false))"""
119 ms
begin
num1 = [1/2, 1]
den1 = [1]
p1func(x) = x/2
local sys = tf(num1, den1)
local bb = bodeplot(sys,label=false, layout=(1,2), xminorticks=true, yminorticks=true, minorgrid=true, xlabel="Frequency [rad/s]", size=(800, 350), bottom_margin=3mm, left_margin=2mm)
local zz = plot!(bb[1], ylim = (0.1, 100))
local zz = plot!(bb[2], ylim=(-5,95))
hline!(bb[1], [1], label=false, line=:dash)
scatter!(bb[1], [2], [1], label=false, marker=:o)
hline!(bb[2], [0, 45, 90], label=false, line=:dash)
vline!(bb[2], [2], label=false, line=:dash)
plot!(bb[1], [0.1, 100], p1func.([0.1, 100]), label=false)
end
end
4.5 s

Problem 2

Draw asymptotes:

md"""#### Problem 2

Draw asymptotes: $(@bind p2_asymptotes CheckBox(default=false))
"""
6.6 ms
begin
num2 = [900]
den2 = [1, 12, 900]
local sys = tf(num2, den2)
local bb = bodeplot(sys,label=false, layout=(1,2), xminorticks=true, yminorticks=true, minorgrid=true, xlabel="Frequency [rad/s]", size=(800, 350), bottom_margin=3mm, left_margin=2mm)
bb = plot!(bb[1], ylim=(0.001, 8))
p2func(x) = (x/30)^(-2)
hline!(bb[2], [0, -90, -180], label=false, line=:dash)
vline!(bb[1], [30], label=false, line=:dash)
vline!(bb[2], [30], label=false, line=:dash)
plot!(bb[1], [5, 300], p2func.([5, 300]), label=false, line=:dash)
scatter!(bb[1], [30], [p2func(30)], marker=:o, label=false)
hline!(bb[1], [1], label=false, line=:dash)
end
end
1.2 s

Bode plots

Problem 3

Draw the Bode plot for the below transfer function

$$G(s) = \dfrac{s+500}{500s+1}$$

md"""## Bode plots

#### Problem 3
Draw the Bode plot for the below transfer function

```math
G(s) = \dfrac{s+500}{500s+1}
```
"""
269 μs

Draw asymptotes:

md"""Draw asymptotes: $(@bind p3_asymptotes CheckBox(default=false))"""
991 μs
begin
num3 = [1, 500]
den3 = [500, 1]
local sys = tf(num3, den3)
bb = bodeplot(sys,label=false, layout=(1,2), xminorticks=true, yminorticks=true, minorgrid=true, xlabel="Frequency [rad/s]", size=(800, 350), bottom_margin=3mm, left_margin=2mm)
local pp1 = plot(xaxis=:log, yaxis=:log, xlim=xlims(bb[1]), ylim=ylims(bb[1]), xminorticks=true, yminorticks=true, minorgrid=true, xlabel="Frequency [rad/s]", ylabel="Magnitude")
local pp2 = plot(xaxis=:log, xlim=xlims(bb[2]), ylim=(-95,5), xminorticks=true, yminorticks=true, minorgrid=true, xlabel="Frequency [rad/s]", ylabel="Phase (deg)")
pp1 = vline!(pp1, [1/500, 500], label=false)
pp2 = vline!(pp2, [1/500, 500], label=false)
pp2 = hline!(pp2, [0,-90], label=false)
pp1 = hline!(pp1, [1/500, 500], label=false)
vline!(bb[1], [1/500, 500], label=false)
vline!(bb[2], [1/500, 500], label=false, ylim=(-95,5))
hline!(bb[2], [0,-90], label=false)
hline!(bb[1], [1/500, 500], label=false)
218 ms

Check solution:

md"""Check solution: $(@bind p3sol CheckBox(default=false))"""
919 μs