Tag Archives: Matlab command

The difference of four kinds of integer function (fix floor ceil round) in MATLAB

There are four integral functions in Matlab: Fix, floor, Ceil and Round. The specific application methods are as follows:

(1) fix
is rounded in the direction of zero
Such as
Fix (1.3) = 1
Fix (1.3) = 1;

(2) floor
is rounded in the direction of minus infinity (the maximum integer not exceeding x. (gaussian is rounded))
Such as
Floor (1.3) = 2
Floor (1.3) = 1;

(3) ceil
is rounded in the direction of positive infinity (the smallest integer greater than x)
Such as
The ceil (1.3) = 1
The ceil (1.3) = 2;

(4) round
rounded to the nearest integer
Such as
Round (1.3) = 1
Round (1.52) = 2
Round (1.3) = 1
Round (1.52) = 2