JuliaDSP / DSP.jl

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

Plotting of FilterCoefficients #226

Open standarddeviant opened 6 years ago

standarddeviant commented 6 years ago

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.

martinholters commented 6 years ago

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.

standarddeviant commented 6 years ago

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

ssfrr commented 6 years ago

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

martinholters commented 3 years ago

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