Skip to content

Commit

Permalink
add additional DSP methods
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed May 22, 2023
1 parent a90f619 commit abb1703
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/ControlSystemsBase/src/dsp.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
tf(p::DSP.PolynomialRatio, h::Real = 1) = tf(DSP.coefb(p), DSP.coefa(p), h)
tf(p::DSP.ZeroPoleGain, h::Real = 1) = tf(DSP.PolynomialRatio(p), h)

tf(p::DSP.PolynomialRatio{:z}, h::Real = 1) = tf(DSP.coefb(p), DSP.coefa(p), h)
tf(p::DSP.PolynomialRatio{:s}) = tf(DSP.coefb(p), DSP.coefa(p))
tf(p::DSP.ZeroPoleGain{:z}, h::Real = 1) = tf(DSP.PolynomialRatio(p), h)
tf(p::DSP.ZeroPoleGain{:s}) = tf(DSP.PolynomialRatio(p))

function DSP.PolynomialRatio(G::TransferFunction{<:Discrete})
DSP.PolynomialRatio(
Expand Down
6 changes: 3 additions & 3 deletions lib/ControlSystemsBase/test/test_dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Gds = DSP.SecondOrderSections(Gd)

u = randn(100)
uf = filt(Gds, u, zeros(2,2))
uf = DSP.filt(Gds, u, zeros(2,2))
uls = lsim(Gd, u').y'
@test uf[1:end-1] uls[2:end]

Expand All @@ -23,8 +23,8 @@
@test fcs.matrix[1].k k

u = randn(10)
uf = filt(f, u)
uf = DSP.filt(f, u)
uls = lsim(fcs, u').y'
@test uf uls

end
end

0 comments on commit abb1703

Please sign in to comment.