DSP.jl icon indicating copy to clipboard operation
DSP.jl copied to clipboard

Plotting of FilterCoefficients

Open standarddeviant opened this issue 7 years ago • 4 comments

I'm following up on this StatPlots.jl issue: https://github.com/JuliaPlots/StatPlots.jl/issues/147 And I'm unsure if I can re-open this DSP.jl issue: https://github.com/JuliaDSP/DSP.jl/issues/203

I have a reasonable prototype of code using RecipesBase.jl here: https://gist.github.com/standarddeviant/0e676140feca9b938943ebeded05b8e1

The main recipe handles a vector of FilterCoefficients, and there's a version that handles a single FilterCoefficients by making a length-1 vector of FilterCoefficients. I've found this useful to look at time/frequency tradeoffs when varying a single filter parameter.

If you download and run that file, this is a fun plot to make:

orders=[1,2,4,6,8,10]
plot(
    digitalfilter.(
        Lowpass(0.1, fs=10),
        Butterworth.(orders)
    ),
    fs=10,
    desc=orders,
    doimp=true,
    dostep=true
)

The julia dot-syntax is wonderful :-) dsp_plot

I'm just offering this up as a potential solution to being able to plot and visualize filters in DSP.jl.

standarddeviant avatar Aug 28 '18 04:08 standarddeviant

This does look nice. I think I'd be Ok with adding adding a dependency on RecipesBase and adding this code, but if others prefer to have it live in a dedicated package I wouldn't mind either.

martinholters avatar Aug 28 '18 06:08 martinholters

@martinholters I'm happy to submit a PR to DSP.jl or create "DSPPlots.jl".

standarddeviant avatar Aug 28 '18 12:08 standarddeviant

I think a RecipesBase dependency is fine, and this doesn't need to be split out into a separate package.

ssfrr avatar Aug 28 '18 13:08 ssfrr

We now transitively depend on RecipesBase anyway (via Polynomials), so even less reason not to do this.

martinholters avatar Nov 02 '20 14:11 martinholters