math::filters(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay so bestie, math::filters is the Digital filters page from the Tcl Math Library πŸ’– it lives in the 3tcl manual, and it's all about filtering your data, no cap.


πŸ¦‹ 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 yes, it needs Tcl 8.6 or 9 and it needs TclOO too, because we're object-oriented in this house πŸ’…


🌸 DESCRIPTION 🌸

The math::filters package implements digital filters, notably Butterworth low-pass and high-pass filters. The procedures let you filter an entire data series or filter data one by one. Both. Your choice. Main character energy either way ✨


πŸŽ€ PROCEDURES πŸŽ€

The package defines the following public procedures:

  • ::math::filters::filterButterworth lowpass order samplefreq cutofffreq β€” figure out the coefficients for a Butterworth filter of the given order. You get back a list of the x-coefficients, the y-coefficients, and the scale. Here's the formula, where n is the filter order:
                                 n             n
                  scale * y_k = sum x_(k-i) + sum y_(k-i)
                                i=0           i=1
  • 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
bestie the second one says lowpass in the original, not order, and I'm not about to gaslight you by "fixing" it. Transcribing it fr fr 🫢
  • ::math::filters::filter coeffs data β€” filter the entire data series based on the filter coefficients. whole series, one call, slay.
    • 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're not given, they're 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


Copyright (c) 2020 by Arjen Markus


and that's the whole vibe check πŸ’– this is tcllib, version 0.3, and the page itself is math::filters(3tcl) β€” go filter something gorgeous, bestie πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from