Skip to content

Commit

Permalink
Merge branch 'master' into ss/complex-bandpass-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah authored Feb 6, 2024
2 parents f901882 + fc28d23 commit 08c30a6
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/Filters/coefficients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,30 @@ PolynomialRatio(f::FilterCoefficients{D}) where {D} = PolynomialRatio{D}(f)
PolynomialRatio(b, a)
Filter representation in terms of the coefficients of the numerator
`b` and denominator `a` of the transfer function:
`b` and denominator `a` in the z or s domain
where `b` and `a` are vectors ordered from highest power to lowest.
Filter with:
- Transfer function in z domain (zero & negative z powers):
```math
H(s) = \\frac{\\verb!b[1]! s^{m-1} + \\ldots + \\verb!b[m]!}{\\verb!a[1]! s^{n-1} + \\ldots + \\verb!a[n]!}
H(z) = \\frac{\\verb!b[1]! + \\ldots + \\verb!b[m]! z^{-m+1}}{\\verb!a[1]! + \\ldots + \\verb!a[n]! z^{-n+1}}
```
or equivalently:
returns `PolynomialRatio` object with `a[1] = 1` and other specified coefficients divided by `a[1]`.
```jldoctest
julia> PolynomialRatio([1,1],[1,2])
PolynomialRatio{:z, Float64}(LaurentPolynomial(1.0*z⁻¹ + 1.0), LaurentPolynomial(2.0*z⁻¹ + 1.0))
julia> PolynomialRatio{:z}([1,2,3],[2,3,4])
PolynomialRatio{:z, Float64}(LaurentPolynomial(1.5*z⁻² + 1.0*z⁻¹ + 0.5), LaurentPolynomial(2.0*z⁻² + 1.5*z⁻¹ + 1.0))
```
- Transfer function in s domain (zero & positive s powers):
```math
H(z) = \\frac{\\verb!b[1]! + \\ldots + \\verb!b[n]! z^{-n+1}}{\\verb!a[1]! + \\ldots + \\verb!a[n]! z^{-n+1}}
H(s) = \\frac{\\verb!b[1]! s^{m-1} + \\ldots + \\verb!b[m]!}{\\verb!a[1]! s^{n-1} + \\ldots + \\verb!a[n]!}
```
returns `PolynomialRatio` object with specified `b` and `a` coefficients.
```jldoctest
julia> PolynomialRatio{:s}([1,2,3],[2,3,4])
PolynomialRatio{:s, Int64}(LaurentPolynomial(3 + 2*s + s²), LaurentPolynomial(4 + 3*s + 2*s²))
```
`b` and `a` may be specified as `Polynomial` objects or
vectors ordered from highest power to lowest.
"""
PolynomialRatio(b, a) = PolynomialRatio{:z}(b, a)
function PolynomialRatio{:z}(b::LaurentPolynomial{T1}, a::LaurentPolynomial{T2}) where {T1,T2}
Expand Down

0 comments on commit 08c30a6

Please sign in to comment.