matlab里面的取整函数fixroundfloor
的有关信息介绍如下:1.fix-向零方向取整。
fixRoundtowardszero.
fix(X)roundstheelementsofXtothenearestintegers
towardszero.
2.fix使用举例:
t=
7.68063.53883.61309.01508.17693.1781
2.33093.47197.41633.18349.81189.8445
5.87362.53727.05905.97088.61995.4825
4.58979.52537.00892.97800.83827.4925
8.60982.98200.06231.25013.7718.4185
6.0841.58413.74353.88362.36131.6689
-----------------------------------------------------------------------
fix(t)
ans=
733983
237399
527585
497207
820138
613321
3.round-向最近的方向取整。
roundRoundtowardsnearestinteger.
round(X)roundstheelementsofXtothenearestintegers.
4.floor-向负无穷大方向取整:
floorRoundtowardsminusinfinity.
floor(X)roundstheelementsofXtothenearestintegers
towardsminusinfinity.
5.ceil-向正无穷大方向取整。
ceilRoundtowardsplusinfinity.
ceil(X)roundstheelementsofXtothenearestintegers
towardsinfinity.
6.mod-计算模数:
modModulusafterdivision.
mod(x,y)isx-n.*ywheren=floor(x./y)ify~=
0.Ifyisnotan
integerandthequotientx./yiswithinroundofferrorofaninteger,
thennisthatinteger.Theinputsxandymustberealarraysofthe
samesize,orrealscalars.
Thestatement"xandyarecongruentmodm"meansmod(x,m)==mod(y,m).
Byconvention:
mod(x,0)isx.
mod(x,x)is
0.
mod(x,y),forx~=yandy~=0,hasthesamesignasy.
Note:REM(x,y),forx~=yandy~=0,hasthesamesignasx.
mod(x,y)andREM(x,y)areequalifxandyhavethesamesign,but
differbyyifxandyhavedifferentsigns.