diff --git a/src/BallAndBeam.jl b/src/BallAndBeam.jl index 33dc2ced3bcf9ec1b0d4a8a993f0acbf21769cf4..2d185fd95d9151d853c354674aa26dc53e641e91 100644 --- a/src/BallAndBeam.jl +++ b/src/BallAndBeam.jl @@ -16,7 +16,7 @@ module BallAndBeam export run_experiment, fra, sortfqs, bopl, bopl!, nypl, nypl!, plot, fbdesign, ffdesign, opendoc -export SysFilter, init_sysfilter, sysfilter!, run_control_2DOF # For documentation +export SysFilter, run_control_2DOF # For documentation using LabProcesses, Plots, Polynomials, ControlSystems, ProgressMeter @@ -139,7 +139,7 @@ nypl(G; kwargs...) = (plot();nypl!(G;kwargs...)) sysFB,L,T,C = fbdesign(G::AbstractMatrix, polevect, zerovect, gain) Frequency Compensation to determine polynominals in compensator C=S/R. Frequency responses for loop transfer, closed loop and controller are calculated. -`sys` is of type `StateSpace`, to be used together with [`sysfilter!`](@ref) +`sys` is of type `StateSpace`, to be used together with [`SysFilter!`](@ref) `G` is a frequency response matrix with ω in the first column and G(iω) in the second. """ function fbdesign(G::AbstractMatrix, polevect, zerovect, gain) @@ -156,7 +156,7 @@ end sysFF,YR,FF = ffdesign(G, polevect, zerovect, gain) Feedforward filter BFF/AFF to shape transfer function from `r` to `y`. Frequency responses for closed loop with FF-filter and FF-filter are calculated. -`sys` is of type `StateSpace`, to be used together with [`sysfilter!`](@ref) +`sys` is of type `StateSpace`, to be used together with [`SysFilter!`](@ref) """ function ffdesign(G, polevect, zerovect, gain) sysFF,YR,_,FF = fbdesign(G, polevect, zerovect, gain) @@ -179,24 +179,13 @@ function opendoc() run(`xdg-open $docpath`) end -""" - state = init_sysfilter(sys::StateSpace) -Use together with [`sysfilter!`](@ref) -""" -init_sysfilter - -""" - output = sysfilter!(state, sys::StateSpace, input) -Returns the filtered output `y` in `y = Cx+Du, x'=Ax+Bu` - -This function is used to implement control loops where a signal is filtered through a -dynamical system, i.e., `U(z) = C(z)E(z)`. Initialize `state` using [`init_sysfilter`](@ref). -""" -sysfilter! """ - sf = SysFilter(sys::StateSpace) -Create a SysFilter object that can be used to implement control loops and simulators with LTI systems, i.e., `U(z) = C(z)E(z)`. See [`sysfilter!`](@ref) for usage. + Csf = SysFilter(sys::StateSpace) +Returns an object used for filtering signals through LTI systems. +Create a SysFilter object that can be used to implement control loops and simulators +with LTI systems, i.e., `U(z) = C(z)E(z)`. To filter a signal `u` through the filter, +call like `y = Csf(u)`. Calculates the filtered output `y` in `y = Cx+Du, x'=Ax+Bu` """ SysFilter diff --git a/src/arx.jl b/src/arx.jl index f670c20b1cff6404fc73c6b4410215234457986f..5eecff1bb446b67e8cb6300696eccd17358670f8 100644 --- a/src/arx.jl +++ b/src/arx.jl @@ -86,10 +86,8 @@ function arx(h,y::AbstractVector{Float64}, u::AbstractVector{Float64}, na, nb; if λ == 0 w = A\y_train - method = :LS else w = (A'A + λ*eye(size(A,2)))\A'y_train - method = :LS_reg end a = [1; -w[1:na]]