Skip to content
Snippets Groups Projects
Commit b5a56bf0 authored by Tommi Nylander's avatar Tommi Nylander
Browse files

Merge branch 'freqrespfix' into 'master'

fixed freqresp to new controlsystems version

See merge request !1
parents f73b559f 73b5daef
Branches
Tags
1 merge request!1fixed freqresp to new controlsystems version
Pipeline #636 canceled
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment