JuliaDSP / DSP.jl

Filter design, periodograms, window functions, and other digital signal processing functionality
https://docs.juliadsp.org/stable/contents/
Other
381 stars 109 forks source link

freqz does not support FIRFilters #185

Open ethomag opened 7 years ago

ethomag commented 7 years ago
julia> f = FIRFilter([.25, 0.5, 0.25]);
julia> freqz(f)
ERROR: MethodError: no method matching freqz(::DSP.Filters.FIRFilter{DSP.Filters.FIRStandard{Float64}})

julia> Pkg.status()
[ ... ]
 - DSP                           0.3.4

I am running Julia 0.6

martinholters commented 7 years ago

Workaround would be freqz(PolynomialRatio(f.h, [1.0])), but a freqz method that takes a FIRFilter (or maybe a FIRFilter{<:FIRStandard}) directly surely wouldn't hurt.

ethomag commented 7 years ago

Thanks Martin! What if I have a decimating FIR filter ?

julia> f = FIRFilter([.25, 0.5, 0.25], 1//2);
martinholters commented 7 years ago

Yea, in general, if ratio ≠ 1, it is unclear whether freqz should compute the frequency response viewed from the input or output side of the filter. That's why I included the possible restriction to FIRFilter{<:FIRStandard} above :wink:

ethomag commented 7 years ago

Good point! In MATLAB, I believe freqz delivers a result viewed from the output side of the filter. I guess that would conform to the "rule of least surprise".

galenlynch commented 6 years ago

freqz still does not accept FIR filters.

fps commented 3 years ago

Hi, this still seems to be the case

(clipping.lv2) pkg> status
Status `C:\Users\fschmidt\syncthing\uni\projects\linux-audio\clipping.lv2\Project.toml`
  [717857b8] DSP v0.6.10
  [91a5bcdd] Plots v1.10.0