.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/lowpassfilter.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_lowpassfilter.py: ============================ Simple lowpass filter design. ============================ .. GENERATED FROM PYTHON SOURCE LINES 6-12 .. code-block:: Python from mplsignal import freqz_fir from fird.designer import FIRDesigner from fird.objective import PiecewiseLinearObjective .. GENERATED FROM PYTHON SOURCE LINES 13-14 First, design a filter minimizing the approximation error using a filter order of 30. .. GENERATED FROM PYTHON SOURCE LINES 14-20 .. code-block:: Python 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() .. image-sg:: /examples/images/sphx_glr_lowpassfilter_001.png :alt: lowpassfilter :srcset: /examples/images/sphx_glr_lowpassfilter_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 21-22 Increase the filter order to 31. .. GENERATED FROM PYTHON SOURCE LINES 22-26 .. code-block:: Python d = FIRDesigner(31, o) d.solve() h31 = d.get_impulse_response() freqz_fir(h31).show() .. image-sg:: /examples/images/sphx_glr_lowpassfilter_002.png :alt: lowpassfilter :srcset: /examples/images/sphx_glr_lowpassfilter_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.358 seconds) .. _sphx_glr_download_examples_lowpassfilter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: lowpassfilter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: lowpassfilter.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: lowpassfilter.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_