Skip to content

Commit 1618093

Browse files
authored
Merge pull request #202 from JuliaControl/fbc/frd-plot-kwargs
Accept keyword arguments passed by the ControlSystemsBase 1.23 plot recipes for FRD
2 parents 6c00501 + 34a44b9 commit 1618093

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎Project.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ControlSystemIdentification"
22
uuid = "3abffc1c-5106-53b7-b354-a47bfc086282"
3-
version = "2.12.1"
3+
version = "2.12.2"
44
authors = ["baggepinnen <baggepinnen@gmail.com>"]
55

66
[deps]

‎src/frd.jl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ end
110110

111111
ControlSystemsBase.noutputs(f::FRD) = f.r isa AbstractVector ? 1 : size(f.r, 1)
112112
ControlSystemsBase.ninputs(f::FRD) = f.r isa AbstractVector ? 1 : size(f.r, 2)
113-
ControlSystemsBase._default_freq_vector(f::Vector{<:FRD}, _) = f[1].w
114-
ControlSystemsBase._default_freq_vector(f::FRD, _) = f.w
115-
function ControlSystemsBase.bode(f::FRD, w::AbstractVector = f.w; unwrap=true)
113+
ControlSystemsBase._default_freq_vector(f::Vector{<:FRD}, _; kwargs...) = f[1].w
114+
ControlSystemsBase._default_freq_vector(f::FRD, _; kwargs...) = f.w
115+
function ControlSystemsBase.bode(f::FRD, w::AbstractVector = f.w; unwrap=true, kwargs...) # kwargs such as balance do not apply to frequency-response data
116116
w == f.w || error("Frequency vector must match the one stored in the FRD")
117117
angles = angle.(f.r)
118118
angles = reshape(angles, f.ny, f.nu, :)

‎test/test_plots.jl‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ welchplot(d)
2121
Gh,_ = tfest(d)
2222
plot(Gh, plotphase=true)
2323

24-
plot(tfest(d))
24+
plot(tfest(d))
25+
26+
# FRD in the ControlSystemsBase plot recipes, which pass keyword arguments such as balance and adaptive
27+
w = exp10.(LinRange(-1, 1, 50))
28+
frd = FRD(w, tf(1, [1, 1, 1]))
29+
mag, phase, _ = bode(frd, w; unwrap=false, balance=true)
30+
@test vec(mag) ≈ abs.(frd.r)
31+
bodeplot(frd)
32+
bodeplot([frd, frd])
33+
nyquistplot(frd)
34+
sigmaplot(frd)

0 commit comments

Comments
 (0)