diff --git a/src/BallAndBeam.jl b/src/BallAndBeam.jl index 2b399863a7c30642f63804e0c06ef2897c1d8522..0cfa11a59f291bc730a710f86cd810b36b144db2 100644 --- a/src/BallAndBeam.jl +++ b/src/BallAndBeam.jl @@ -173,7 +173,7 @@ function fbdesign(G::AbstractMatrix, polevect, zerovect, gain) ω = Float64.(G[:,1]) pzv = isempty(zerovect) ? 1 : prod(abs.(zerovect)) sysFB = ss(zpk(zerovect,polevect,gain*prod(abs.(polevect))/pzv)) - C = Number[ω freqresp(sysFB, ω)[1][:]] + C = Number[ω freqresp(sysFB, ω)] L = Number[ω G[:,2].*C[:,2]] T = Number[ω L[:,2]./(1+L[:,2])] sysFB,L,T,C diff --git a/test/runtests.jl b/test/runtests.jl index d2541fc850fb5ff6f7e2e7821ecf03c3b008c80a..402ec4587324b0ce199395ef6159594dfed2b125 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -49,9 +49,9 @@ w1_100 = logspace(-1,log10(300),500) G1 = fra(P, w1_100, amplitude=1, nbr_of_periods=nbr_of_periods, settling_time=settling_time) true_resp = freqresp(P.s.sys, w1_100) -@test sum(abs, log.(abs.(G1[:,2])) - log.(abs.(true_resp[1][:]))) < 3.2 # Some numerical errors expected +@test sum(abs, log.(abs.(G1[:,2])) - log.(abs.(true_resp))) < 3.2 # Some numerical errors expected phase_id = angle.(G1[:,2]) |> ControlSystems.unwrap -phase_true = angle.(true_resp[1][:]) |> ControlSystems.unwrap +phase_true = angle.(true_resp) |> ControlSystems.unwrap @test sum(abs, (phase_id-phase_true)[1:400]) < 0.065 @test sum(abs, (phase_id-phase_true)[400:end]) < 5.3 # Some numerical errors for high freqs @@ -75,11 +75,11 @@ arxtf,_ = arx(h, y[:], u, na, nb; λ = 0) w1_100 = logspace(-1,log10(100),500) true_resp = freqresp(P.s.sys, w1_100) -phase_true = angle.(true_resp[1][:]) |> ControlSystems.unwrap +phase_true = angle.(true_resp) |> ControlSystems.unwrap arx_resp = freqresp(arxtf, w1_100) -@test sum(abs, log.(abs.(arx_resp[1][:])) - log.(abs.(true_resp[1][:]))) < 1.25 +@test sum(abs, log.(abs.(arx_resp)) - log.(abs.(true_resp))) < 1.25 -phase_id = angle.(arx_resp[1][:]) |> ControlSystems.unwrap +phase_id = angle.(arx_resp) |> ControlSystems.unwrap @test sum(abs, (phase_id-phase_true)[1:400]) < 21