MATLAB中取最接近的整数的函数应用

2026-02-13 09:24:07

1、命令窗口输入round(),括号内输入需要取最接近的整数的数字。

2、实例1

>> round(1.2)

ans =

     1

3、实例2

>> round(2.5)

ans =

     3

4、实例3

>> round(-2.5)        当他为负数时,向绝对值大的方向取整

ans =

-3

猜你喜欢