From 73b5daefe81317d98168c8fb1946755f94a028d0 Mon Sep 17 00:00:00 2001 From: Tommi Nylander <tommi.nylander@control.lth.se> Date: Fri, 14 Sep 2018 16:09:23 +0200 Subject: [PATCH] fixed to new controlsystems version --- src/BallAndBeam.jl | 2 +- test/runtests.jl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/BallAndBeam.jl b/src/BallAndBeam.jl index 2b39986..0cfa11a 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 d2541fc..402ec45 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 -- GitLab