Note
Go to the end to download the full example code.
Simple lowpass filter design.ΒΆ
from mplsignal import freqz_fir
from fird.designer import FIRDesigner
from fird.objective import PiecewiseLinearObjective
First, design a filter minimizing the approximation error using a filter order of 30.
o = PiecewiseLinearObjective([0, 0.3, 0.5, 1], [1, 1, 0, 0])
d = FIRDesigner(30, o)
d.solve()
h30 = d.get_impulse_response()
freqz_fir(h30).show()

Increase the filter order to 31.
d = FIRDesigner(31, o)
d.solve()
h31 = d.get_impulse_response()
freqz_fir(h31).show()

Total running time of the script: (0 minutes 1.358 seconds)