Matlab的Floor, Ceil, Fix, Round
B = floor(A) rounds the elements of A to the nearest integers less than or equal to A. For complex A, the imaginary and real parts are rounded independently.? (floor:朝負無窮方向舍入)
B = ceil(A) rounds the elements of A to the nearest integers greater than or equal to A. For complex A, the imaginary and real parts are rounded independently. (ceil:朝正無窮方向舍入)
B = fix(A) rounds the elements of A toward zero, resulting in an array of integers. For complex A, the imaginary and real parts are rounded independently. (fix:朝零方向舍入 )
B = round(A) rounds the elements of X to the nearest integers. For complex X, the imaginary and real parts are rounded independently. (round:四舍五入)
>> ceil(9.6)
ans =
??? 10
>> ceil(-9.6)
ans =
??? -9
>> floor(-9.6)
ans =
?? -10
>> floor(9.6)
ans =
???? 9
>> fix(9.6)
ans =
???? 9
>> fix(-.6)
ans =
???? 0
>> fix(-.336)
ans =
???? 0
>> round(-.6)
ans =
??? -1
>> round(-.7)
ans =
??? -1
>> round(-.3)
ans =
???? 0
>> round(.6)
ans =
???? 1
>> round(.5)
ans =
???? 1
總結
以上是生活随笔為你收集整理的Matlab的Floor, Ceil, Fix, Round的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab中sum函数
- 下一篇: matlab randint函数