Hi everyone,
I want to announce FIRLSFilterDesign.jl, which is a package that allows you to design linear phase Finite Impulse Response filters using weighted Least-Squares.
It supports:
- All types of linear phase FIR filters (type I, II, III, and IV)
- Piecewise-linear amplitude response-, and weighting functions
To design a type I passband filter you run the following commands in the Julia REPL:
using Pkg; Pkg.update(); Pkg.add("FIRLSFilterDesign")
using FIRLSFilterDesign
fs = 60 #Sampling frequency in Hz
filter_order = 10
antisymmetric = false
f_bands = [0. 10; 10 20; 20 30] #Frequency bands have to span [0,fs/2] and should not overlap
desired = [0. 0; 1 1; 0 0 ]
filter_coeff = firls_design(filter_order, f_bands, desired, antisymmetric; fs = fs)
If you want to apply a weighting function do the following:
using Pkg; Pkg.update(); Pkg.add("FIRLSFilterDesign")
using FIRLSFilterDesign
fs = 60 #Sampling frequency in Hz
filter_order = 10
antisymmetric = false
f_bands = [0. 10; 10 20; 20 30] #Frequency bands have to span [0,fs/2] and should not overlap
desired = [0. 0; 1 1; 0 0 ]
weights = [1. 2; 2 2; 2 1]
filter_coeff = firls_design(filter_order, f_bands, desired, weights, antisymmetric; fs = fs)
There are docs but they are not 100% there yet, planning on updating them over the course of a few weeks.
Cheers!