1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
[comment {-*- tcl -*- doctools manpage}]
[vset VERSION 0.3]
[manpage_begin math::filters n [vset VERSION]]
[keywords digital]
[keywords filtering]
[copyright {2020 by Arjen Markus}]
[moddesc {Tcl Math Library}]
[titledesc {Digital filters}]
[category Mathematics]
[require Tcl "8.6 9"]
[require TclOO]
[require math::filters [opt [vset VERSION]]]
[description]
[para]
The [package math::filters] package implements digital filters,
notably Butterworth low-pass and high-pass filters. The procedures
allow to filter an entire data series as well as filter data one
by one.
[section "PROCEDURES"]
The package defines the following public procedures:
[list_begin definitions]
[call [cmd ::math::filters::filterButterworth] [arg lowpass] [arg order] [arg samplefreq] [arg cutofffreq]]
Determine the coefficients for a Butterworth filter of given order. The coefficients are returned as
a list of the x-coefficients, the y-coefficients and the scale. The formula is (n is the filter order):
[example {
n n
scale * y_k = sum x_(k-i) + sum y_(k-i)
i=0 i=1
}]
[list_begin arguments]
[arg_def bool lowpass] Generate a low-pass filter (1) or a high-pass filter (0)
[arg_def integer lowpass] The order of the filter to be generated
[arg_def double samplefreq] Sampling frequency of the data series
[arg_def double cutofffreq] Cut-off frequency for the filter
[list_end]
[call [cmd ::math::filters::filter] [arg coeffs] [arg data]]
Filter the entire data series based on the filter coefficients.
[list_begin arguments]
[arg_def list coeffs] List of coefficients as generated by [emph filterButterworth] (or in fact any similar list of coefficients)
[arg_def list data] Data to be filtered
[list_end]
[call [cmd ::math::filters::filterObj] new [arg coeffs] [arg 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_begin arguments]
[arg_def list coeffs] List of coefficients as generated by [emph filterButterworth] (or in fact any similar list of coefficients)
[arg_def list yinit] (Optional) initial data for the filter result.
[list_end]
[call [cmd \$filterObj] filter [arg x]]
Filter a single value and return the result.
[list_begin arguments]
[arg_def double x] The value to be filtered
[list_end]
[call [cmd \$filterObj] reset]
Reset the filter object (start anew)
[list_end]
[manpage_end]
|