Threshold - Maple Help

SignalProcessing

 Threshold
 perform thresholding operations on an array of samples

 Calling Sequence Threshold(A, level)

Parameters

 A - Array of (real or complex) numeric values; the signal level - realcons or [realcons, realcons], threshold value(s)

Options

 • absolutevalue : truefalse, specifies whether or not to use absolute values when thresholding
 • container : Array, predefined Array for holding results
 • comparison : lessthan, greaterthan, or lessgreater; type of comparison
 • inplace : truefalse, specifies that output should overwrite input
 • value : realcons or [realcons, realcons], alternative values to replace level values

Description

 • The Threshold command performs thresholding operations on samples, which means retaining or discarding data points that do not meet some kind of minimality criterion.
 • If the comparison option is lessthan (the default), then "less-than" thresholding is done on the Array A and the result, an Array B having the same length and datatype, is returned. The threshold is determined by the value of the parameter level as follows for real data.

${B}_{k}=\left\{\begin{array}{cc}{A}_{k}& \mathrm{level}\le {A}_{k}\\ \mathrm{level}& \mathrm{otherwise}\end{array}\right\$

 • For a complex Array A, the value of the level parameter must be real and non-negative. In this case, the formula governing the thresholding function is given by

${B}_{k}=\left\{\begin{array}{cc}\frac{{A}_{k}\mathrm{level}}{\left|{A}_{k}\right|}& \left|{A}_{k}\right|<\mathrm{level}\\ {A}_{k}& \mathrm{otherwise}\end{array}\right\$

 • If the comparison option is greaterthan, then "greater-than" thresholding is done on the Array A. This is similar to the process described for comparison=lessthan, except that the less-than symbol is replaced by the greater-than symbol in the definitions shown above.
 • If the absolutevalue option is set to true then thresholding is done on absolute values. The formula in this case, with comparison=lessthan, is shown below. With comparison=greaterthan, the inequality $\left|{A}_{k}\right|<\mathrm{level}$ is replaced by $\mathrm{level}<\left|{A}_{k}\right|$. Note that this option works with real data only. The default value is false.

${B}_{k}=\left\{\begin{array}{cc}\mathrm{level}& 0\le {A}_{k}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left|{A}_{k}\right|<\mathrm{level}\\ -\mathrm{level}& {A}_{k}<0\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left|{A}_{k}\right|<\mathrm{level}\\ {A}_{k}& \mathrm{otherwise}\end{array}\right\$

 • The value option allows you to specify an alternative real value to place in the output Array instead of level, as shown in the formulae below, with comparison=lessthan:

${B}_{k}=\left\{\begin{array}{cc}\mathrm{value}& {A}_{k}<\mathrm{level}\\ {A}_{k}& \mathrm{otherwise}\end{array}\right\$

 for real Arrays, and

${B}_{k}=\left\{\begin{array}{cc}\mathrm{value}& \left|{A}_{k}\right|<\mathrm{level}\\ {A}_{k}& \mathrm{otherwise}\end{array}\right\$

 for complex Arrays.
 • The value option also works with comparison=greaterthan, and in this case, the inequalities in the formulae above are reversed. In addition, the comparison option  can also take the lessgreater value, where both "less-than" and "greater-than" conditions are used. In this case, the level parameter and the value option should each be a list of two real values, and level[1] must be less than level[2].
 • By default, the value option is equal to level. Values in the Array A that are less than level[1] are set to value[1] in B, while those values in A that are greater than level[2] are set to value[2] in B. The precise formula used is

${B}_{k}=\left\{\begin{array}{cc}\mathrm{value\left[1\right]}& {A}_{k}<\mathrm{level\left[1\right]}\\ \mathrm{value\left[2\right]}& \mathrm{level\left[2\right]}<{A}_{k}\\ {A}_{k}& \mathrm{otherwise}\end{array}\right\$

 • Before the code performing the computation runs, Maple converts A to a hardware datatype, first attempting float[8] and subsequently complex[8], unless it already has one of these datatypes. For this reason, it is most efficient if A has one of these datatypes beforehand.
 • If the container=C option is provided, then the results are put into C and C is returned. With this option, no additional memory is allocated to store the result. The container must be an Array having datatype and size equal to those of A.
 • If the inplace or inplace=true option is provided, then A is overwritten with the results. In this case, the container option is ignored. Furthermore, A must have one of the datatypes float[8] and complex[8].

 • The SignalProcessing[Threshold] command is thread-safe as of Maple 17.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $a≔\mathrm{GenerateUniform}\left(10,-1,1\right)$
 ${a}{≔}\left[\begin{array}{cccccccccc}{0.995867573674919}& {0.408337529411819}& {0.167610888327636}& {-0.246858837322246}& {0.432866472071836}& {-0.439979858216147}& {0.432901310269353}& {0.481379433115581}& {-0.477697063372826}& {0.0288390346482901}\end{array}\right]$ (1)
 > $\mathrm{Threshold}\left(a,0.2\right)$
 $\left[\begin{array}{cccccccccc}{0.995867573674919}& {0.408337529411819}& {0.200000000000000}& {0.200000000000000}& {0.432866472071836}& {0.200000000000000}& {0.432901310269353}& {0.481379433115581}& {0.200000000000000}& {0.200000000000000}\end{array}\right]$ (2)
 > $\mathrm{Threshold}\left(a,0.2,'\mathrm{absolutevalue}'\right)$
 $\left[\begin{array}{cccccccccc}{0.995867573674919}& {0.408337529411819}& {0.200000000000000}& {-0.246858837322246}& {0.432866472071836}& {-0.439979858216147}& {0.432901310269353}& {0.481379433115581}& {-0.477697063372826}& {0.200000000000000}\end{array}\right]$ (3)
 > $\mathrm{Threshold}\left(a,0.2,'\mathrm{comparison}'='\mathrm{greaterthan}'\right)$
 $\left[\begin{array}{cccccccccc}{0.200000000000000}& {0.200000000000000}& {0.167610888327636}& {-0.246858837322246}& {0.200000000000000}& {-0.439979858216147}& {0.200000000000000}& {0.200000000000000}& {-0.477697063372826}& {0.0288390346482901}\end{array}\right]$ (4)
 > $\mathrm{Threshold}\left(a,0.2,'\mathrm{value}'=\mathrm{\pi }\right)$
 $\left[\begin{array}{cccccccccc}{0.995867573674919}& {0.408337529411819}& {3.14159265400000}& {3.14159265400000}& {0.432866472071836}& {3.14159265400000}& {0.432901310269353}& {0.481379433115581}& {3.14159265400000}& {3.14159265400000}\end{array}\right]$ (5)
 > $\mathrm{Threshold}\left(a,\left[-0.3,0.2\right],'\mathrm{comparison}'='\mathrm{lessgreater}'\right)$
 $\left[\begin{array}{cccccccccc}{0.200000000000000}& {0.200000000000000}& {0.167610888327636}& {-0.246858837322246}& {0.200000000000000}& {-0.300000000000000}& {0.200000000000000}& {0.200000000000000}& {-0.300000000000000}& {0.0288390346482901}\end{array}\right]$ (6)
 > $\mathrm{Threshold}\left(a,\left[-0.3,0.2\right]\right)$
 $\left[\begin{array}{cccccccccc}{0.200000000000000}& {0.200000000000000}& {0.167610888327636}& {-0.246858837322246}& {0.200000000000000}& {-0.300000000000000}& {0.200000000000000}& {0.200000000000000}& {-0.300000000000000}& {0.0288390346482901}\end{array}\right]$ (7)
 > $\mathrm{Threshold}\left(a,\left[-0.3,0.2\right],'\mathrm{value}'=\left[-\mathrm{\pi },\mathrm{\pi }\right]\right)$
 $\left[\begin{array}{cccccccccc}{3.14159265400000}& {3.14159265400000}& {0.167610888327636}& {-0.246858837322246}& {3.14159265400000}& {-3.14159265400000}& {3.14159265400000}& {3.14159265400000}& {-3.14159265400000}& {0.0288390346482901}\end{array}\right]$ (8)

Compatibility

 • The SignalProcessing[Threshold] command was introduced in Maple 17.
 • For more information on Maple 17 changes, see Updates in Maple 17.