diff --git a/Project.toml b/Project.toml index 504fd7a5..67ce11bd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ControlSystemIdentification" uuid = "3abffc1c-5106-53b7-b354-a47bfc086282" -version = "2.12.1" +version = "2.12.2" authors = ["baggepinnen "] [deps] diff --git a/src/frd.jl b/src/frd.jl index d968e57b..4591c95a 100644 --- a/src/frd.jl +++ b/src/frd.jl @@ -110,9 +110,9 @@ end ControlSystemsBase.noutputs(f::FRD) = f.r isa AbstractVector ? 1 : size(f.r, 1) ControlSystemsBase.ninputs(f::FRD) = f.r isa AbstractVector ? 1 : size(f.r, 2) -ControlSystemsBase._default_freq_vector(f::Vector{<:FRD}, _) = f[1].w -ControlSystemsBase._default_freq_vector(f::FRD, _) = f.w -function ControlSystemsBase.bode(f::FRD, w::AbstractVector = f.w; unwrap=true) +ControlSystemsBase._default_freq_vector(f::Vector{<:FRD}, _; kwargs...) = f[1].w +ControlSystemsBase._default_freq_vector(f::FRD, _; kwargs...) = f.w +function ControlSystemsBase.bode(f::FRD, w::AbstractVector = f.w; unwrap=true, kwargs...) # kwargs such as balance do not apply to frequency-response data w == f.w || error("Frequency vector must match the one stored in the FRD") angles = angle.(f.r) angles = reshape(angles, f.ny, f.nu, :) diff --git a/test/test_plots.jl b/test/test_plots.jl index ffbd4b93..be56ebda 100644 --- a/test/test_plots.jl +++ b/test/test_plots.jl @@ -21,4 +21,14 @@ welchplot(d) Gh,_ = tfest(d) plot(Gh, plotphase=true) -plot(tfest(d)) \ No newline at end of file +plot(tfest(d)) + +# FRD in the ControlSystemsBase plot recipes, which pass keyword arguments such as balance and adaptive +w = exp10.(LinRange(-1, 1, 50)) +frd = FRD(w, tf(1, [1, 1, 1])) +mag, phase, _ = bode(frd, w; unwrap=false, balance=true) +@test vec(mag) ≈ abs.(frd.r) +bodeplot(frd) +bodeplot([frd, frd]) +nyquistplot(frd) +sigmaplot(frd) \ No newline at end of file