Clip

Clip[x]

gives x clipped to be between and .

Clip[x,{min,max}]

gives x for minxmax, min for x<min and max for x>max.

Clip[x,{min,max},{vmin,vmax}]

gives vmin for x<min and vmax for x>max.

Details

  • Clip[x] is effectively equivalent to Piecewise[{{-1,x<-1},{+1,x>+1}},x].
  • The vi, as well as other arguments of Clip, need not be numbers.
  • For exact numeric quantities, Clip internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.

Examples

open allclose all

Basic Examples  (3)

The unit clip function:

In[1]:=
Click for copyable input
Out[1]=

Use different clip levels:

In[1]:=
Click for copyable input
Out[1]=

Use symbolic operations:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Applications  (1)

Possible Issues  (1)

See Also

Sign  Piecewise  Min  Rescale  Round  Chop  Tanh  Unitize  Threshold

Tutorials

Introduced in 2004
(5.1)