math::filters(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– math::filters β€” the digital filters era πŸ’–

ok so bestie, this one lives in the Tcl Math Library (that's the manual section n, iykyk), and it's giving math girlie main character energy. come sit with me, we're gonna filter some signals πŸ¦‹


✨ NAME ✨

math::filters β€” Digital filters. that's it, that's the vibe. πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.6 9

package require TclOO

package require math::filters ?0.3?

::math::filters::filterButterworth lowpass order samplefreq cutofffreq

::math::filters::filter coeffs data

::math::filters::filterObj new coeffs yinit

$filterObj filter x

$filterObj reset

like. look at her. she requires Tcl 8.6 9, she requires TclOO (object era fr fr), and she'll take math::filters version 0.3 if you're feeling fancy ✨


πŸŽ€ DESCRIPTION πŸŽ€

So the math::filters package implements digital filters, and notably Butterworth low-pass and high-pass filters. iconic behavior honestly.

The procedures let you filter an entire data series all at once, OR filter your data one by one like a little snack. both are valid, both are slay. πŸ”₯


πŸ’… PROCEDURES πŸ’…

here's the whole roster, bestie. the package defines these public procedures:

  • ::math::filters::filterButterworth lowpass order samplefreq cutofffreq β€” Determine the coefficients for a Butterworth filter of given order. The coefficients come back as a list of the x-coefficients, the y-coefficients, and the scale. The formula is (and n is the filter order, bestie, don't forget her):
                                 n             n
                  scale * y_k = sum x_(k-i) + sum y_(k-i)
                                i=0           i=1

and the args are:

  • bool lowpass β€” Generate a low-pass filter (1) or a high-pass filter (0)
  • integer lowpass β€” The order of the filter to be generated
  • double samplefreq β€” Sampling frequency of the data series
  • double cutofffreq β€” Cut-off frequency for the filter
  • ::math::filters::filter coeffs data β€” Filter the entire data series based on the filter coefficients.
    • list coeffs β€” List of coefficients as generated by filterButterworth (or in fact any similar list of coefficients)
    • list data β€” Data to be filtered
  • ::math::filters::filterObj new coeffs yinit β€” Create a filter object. The initial x data are taken as zero. The initial y data can be prescribed. If they are not given, they are taken as zero as well.
    • list coeffs β€” List of coefficients as generated by filterButterworth (or in fact any similar list of coefficients)
    • list yinit β€” (Optional) initial data for the filter result.
  • $filterObj filter x β€” Filter a single value and return the result.
    • double x β€” The value to be filtered
  • $filterObj reset β€” Reset the filter object (start anew) 🧚

🌈 KEYWORDS 🌈

digital, filtering


πŸ‘‘ CATEGORY πŸ‘‘

Mathematics β€” yes bestie, she's a math girlie, we knew this πŸ’œ


Copyright (c) 2020 by Arjen Markus


and that's the whole page, bestie 🫢 this was brought to you by tcllib, version 0.3, answering to the name math::filters(n) β€” go forth and filter, you've got this βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from