Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to round off decimals in matlab?
How to round off decimals in matlab?
There are four commonly used integer functions in matlab, namely floor, ceil, round and fix, which can complete integer operation of constants.

1 and floor are rounded down, that is, to negative infinity.

2.ceil is rounded up, that is, rounded to positive infinity.

3. A circle is the nearest one, that is, a circle.

4.fix is rounded to 0, that is, rounded to the direction close to 0.

In addition, integer operations can also be performed on vectors, matrices or multidimensional arrays. For example, for matrix A, round(A) represents rounding all elements of matrix A. ..

Extended data:

For these three integer functions, when the input parameters are complex numbers, the real part and imaginary part will be rounded up respectively. For example, if the integer command round( 1. 1+3.7i) is input, the result of rounding is 1+4 i, which will be returned as a double value when the input parameter is a char type or a logical value.

References:

MATLAB document