matlab 取整函数 fix floor ceil round

来源:互联网 发布:图知天下 编辑:程序博客网 时间:2024/05/05 06:42

MATLAB取整函数

(1)fix(x) : 截尾取整.

fix( [3.12 -3.12])

ans =

 3    -3

(2)floor(x):不超过x 的最大整数.(高斯取整)

floor( [3.12 -3.12])

ans =

 3    -4

(3)ceil(x) : 大于x 的最小整数

ceil( [3.12 -3.12])

ans =

 4    -3

(4)四舍五入取整

round(3.12 -3.12)

ans =

 0

round([3.12 -3.12])

ans =

 3    -3
0 0
原创粉丝点击