FPGA Player

好记性不如烂笔头

导航

MATLAB的取整函数:fix(x),floor(x),ceil(x),round(x)

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

>> fix( [3.12 -3.12])

ans =

     3    -3

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

>> floor( [3.12 -3.12])

ans =

     3    -4

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

>> ceil( [3.12 -3.12])

ans =

     4    -3

(4)四舍五入取整

>> round([3.12 -3.12])

ans =

     3    -3

posted on 2012-08-12 19:53  中国的孩子  阅读(270)  评论(0编辑  收藏  举报