FIX Round Towards Zero

Section: Mathematical Functions

Usage

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.

Example

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 = 
  <dcomplex>  - size: [1 6]
 
Columns 1 to 1
 -1.800000000000000 0.000000000000000i  
 
Columns 2 to 2
  3.141592653589793 0.000000000000000i  
 
Columns 3 to 3
  8.000000000000000 0.000000000000000i  
 
Columns 4 to 4
 -3.141592653589793 0.000000000000000i  
 
Columns 5 to 5
 -0.001000000000000 0.000000000000000i  
 
Columns 6 to 6
  2.300000000000000+ 0.300000000000000i  
--> fix(a)
ans = 
  <dcomplex>  - size: [1 6]
 
Columns 1 to 6
  -1  0i    3  0i    8  0i   -3  0i    0  0i    2  0i