threshold changes the data in an array which does not meet some kind of minimality criterion. It takes the following parameters :
Bound specification may be either a single real number b (or an equation b=value) or a list of two real numbers l,u (or equations l=lvalue, u=uvalue). In the latter case a vector w is returned, as defined by :
w_{k}= 

for k=0,1,…,n−1 where n= size( v ) when the element v_{k} is a real number. If v_{k} is complex, then v_{k} is compared with u resp. l and the value uvalue resp. lvalue is multiplied by v_{k}/v_{k} .
In the first case where bnd is a number or an equation, the return vector w is defined by :
w_{k}= 

if v_{k}∈ℝ (if v_{k} is complex, then v_{k} is compared with b and the value is multiplied by v_{k}/v_{k} ), for k=0,1,…,n−1 . If comparison operator is specified (one of >, <= or >=, must be quoted), it is used instead of < (which is the default) in the above formula. If the fourth argument is specified, the data in v must be real and the following formula is used for w_{k} , k=0,1,…,n−1 :
w_{k}= 

As before, value defaults to b and the comparison operator used to test v_{k} against b (by default <) is specified by the third argument.
For example, input :
Output :
Input :
Output :
Input :
Output :
Input :
Output :
Input :
Output :
Input :
Output :
In the following example, a squarelike wave is created from a single sine wave by clipping sample values. Input :
Output :
Input :
Output :