matlab-常用函数(2)
matlab取整函数:
- floor()
floor()函数为向下取整函数,如下:
floor(0.5)
ans=
0
floor(-0.5)
ans=
-1
- ceil()
ceil()函数为向上取整,如下:
ceil(0.5)
ans=
1
ceil(-0.5)
ans=
0
- round()
round()函数的值始终趋于远离0点,如下:
round(0.5)
ans=
1
round(-0.5)
ans=
-1
- fix()
fix()函数的值始终趋于靠近0点,如下:
fix(0.5)
ans=
0
fix(-0.5)
ans=
0

浙公网安备 33010602011771号