FreeMat
|
Section: Mathematical Functions
Rounds the argument array towards zero. The syntax for its use is
y = fix(x)
where x
is a numeric array. For positive elements of x
, the output is the largest integer smaller than x
. For negative elements of x
the output is the smallest integer larger than x
. For complex x
, the operation is applied seperately to the real and imaginary parts.
Here is a simple example of the fix
operation on some values
--> a = [-1.8,pi,8,-pi,-0.001,2.3+0.3i] a = Columns 1 to 3 -1.8000 + 0.0000i 3.1416 + 0.0000i 8.0000 + 0.0000i Columns 4 to 6 -3.1416 + 0.0000i -0.0010 + 0.0000i 2.3000 + 0.3000i --> fix(a) ans = Columns 1 to 3 -1.0000 + 0.0000i 3.0000 + 0.0000i 8.0000 + 0.0000i Columns 4 to 6 -3.0000 + 0.0000i 0 2.0000 + 0.0000i