In my opinion, you’re hitting the limits of what remez
can do. Unfortunately, firls
and other more modern design algorithms don’t exist in DSP.jl yet, and FIRWindow
does not allow specifying the transition bands.
Note that Matlab also struggles with this filter. Using firls
:
h = firls(299, [0 8 10 30 36 fn]./fn, [0 0 1 1 0 0]);
fir1
does not support specifying transition bands (this command is equivalent to DSP.jl’s FIRWindow
design method). The best results are obtained with fir2
, but note that the transition bands seem quite a bit wider than specified:
h=fir2(299, [0 8 10 30 36 fn]./fn, [0 0 1 1 0 0]);
What I would do in your case is to use remez
to design a filter with narrow transition bands, flat passband, and good (40 dB or more) rejection, and move on If you absolutely want to use the same filter as the textbook, you can generate the filter coefficients in Matlab and copy/paste them to your Julia program. If you don’t have access to Matlab, send me the code and I’ll send you the coefficients.
I hope I can find the time soon to implement firls
and other design algorithms for DSP.jl, if nobody else beats me to it…