matlab-经常使用函数(2)

matlab取整函数:函数

  • floor()

   floor()函数为向下取整函数,以下:
spa

floor(0.5)
ans=
        0

floor(-0.5)
ans=
        -1
  • ceil()

   ceil()函数为向上取整,以下: blog

 

ceil(0.5)
ans=
        1

ceil(-0.5)
ans=
        0

 

  • round()

   round()函数的值始终趋于远离0点,以下:class

 

round(0.5)
ans=
        1

round(-0.5)
ans=
        -1

 

  • fix()

   fix()函数的值始终趋于靠近0点,以下:di

fix(0.5)
ans=
        0

fix(-0.5)
ans=
        0
相关文章
相关标签/搜索