Programmer Guide/Command Reference/EVAL/limit: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 7: Line 7:
:;<var>lo</var>: lower boundary, must be a number
:;<var>lo</var>: lower boundary, must be a number
:;<var>hi</var>: upper boundary, must be a number
:;<var>hi</var>: upper boundary, must be a number
;Result: The result r has the same type as ''x'' but the values of the elements of r are limited to the boundaries defined by ''lo'' and/or ''hi''.
;Result: The result r is a copy of ''x'' but the values of the elements of r are limited to the boundaries defined by ''lo'' and/or ''hi''.
::''r''<sub>i,j</sub> is set to ''lo'' if x<sub>i,j</sub> is lower than ''lo'' (functions '''limit''' and '''limitlow''')
::''r''<sub>i,j</sub> is set to ''lo'' if x<sub>i,j</sub> is lower than ''lo'' (functions '''limit''' and '''limitlow''')
::''r''<sub>i,j</sub> is set to ''hi'' if x<sub>i,j</sub> is greater than ''hi'' (functions '''limit''' and '''limithigh''')
::''r''<sub>i,j</sub> is set to ''hi'' if x<sub>i,j</sub> is greater than ''hi'' (functions '''limit''' and '''limithigh''')

Revision as of 13:08, 6 April 2011

Limit the values of argument x to a particular range of values.

Usage
limit(x, lo, hi)
limitlow(x, lo)
limithigh(x, hi)
x
a scalar, vector or matrix
lo
lower boundary, must be a number
hi
upper boundary, must be a number
Result
The result r is a copy of x but the values of the elements of r are limited to the boundaries defined by lo and/or hi.
ri,j is set to lo if xi,j is lower than lo (functions limit and limitlow)
ri,j is set to hi if xi,j is greater than hi (functions limit and limithigh)
See also
vsubc, select

Example:

#a := eval vv(1,2,3,4,5,4,3,2,1)
#b := eval fill(9,0,1)
#c := eval limitlow($#a, 3)
// -> $#c = { 3 , 3 , 3 , 4 , 5 , 4 , 3 , 3 , 3 } 
#d := eval limit($#b, 2, 6)
// -> $#d[*,0] = { 2 , 2 , 3 , 4 , 5 , 4 , 3 , 2 , 2 }
//    $#d[*,1] = { 2 , 2 , 2 , 3 , 4 , 5 , 6 , 6 , 6 }

<function list>

limit

Limit the input values to a particular range of values.

Usage:

limit(val, lo, hi)

Function:

Limit the val values to the range of values between lo and hi (lo<=val<=hi). VAlues outside the range are set to the boundary values.

Parameters:
val
The input scalar, vector or matrix.
lo
The lower boundary scalar.
hi
The upper boundary scalar.

Navigation menu

Personal tools