|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
关于floor函数的作用:
( ^2 N! { K- F3 j8 C& F! A( {1 N M2 z/ \+ F1 o4 |) j* P0 K
floor:朝负无穷方向舍入
' K4 D% t% {( Z, ]6 S3 T: ]8 h0 @- d9 b* P, Y" W
B = floor(A) rounds the elements of A to the nearest integers less than or equal to A.
& H% t4 p* R9 D2 w1 U5 m: e1 f' V7 |. y2 ]
ceil:朝正无穷方向舍入" i- t0 v7 k1 `: r
4 Q7 j' Y6 {: m uB = ceil(A) rounds the elements of A to the nearest integers greater than or equal to A.
' U* o- i. n7 }- s' O* ?4 W( D, K' \ `
fix:朝零方向舍入; N \& V+ O# I% a' J
! A0 `& y# s& w: u1 B M! }4 _# }) G
B = fix(A) rounds the elements of A toward zero, resulting in an array of integers.
" o& a9 R Y, i! @, `9 p# u2 y0 v# O6 U/ X+ l9 w
round:四舍五入# _ `7 R4 D" N" ]! [, j% A0 z
9 R7 ^3 `$ h* c! _ i
B = round(A) rounds the elements of X to the nearest integers.
9 |3 N" C# V* c3 C! ^% F
* F0 n% {. G7 k1 \ d2 o* c: onorm:求矩阵或向量的泛数& v1 s8 e4 ]0 _. h' _
* Y# X# C9 k* I( L q+ r5 C x = [1 2 3 4 5 6]; ]3 X; Y$ G# G0 Q- M3 J9 f
' l6 ^0 X9 n6 T' ~- M0 G/ N" n0 p3 \ norm(x) = 9.5394
0 `' W! M( R* O' W3 P
^3 g( j0 y$ L( y2 S) c% kExample:; \' q0 W5 R7 B: y* S
4 {; Q, W% P7 a5 {! m' y9 c
a= [-0.9, -2.1, -0.4, 0.3, 0.8, 1.1, 2.7, -1.2+2.9i];/ d! j3 p2 z# o. g: s# n# x
* ^( c$ z! p; j; X# W1 V' @floor(a)=[ -1, -3, -1, 0, 0, 1, 2, -2+2i]( L$ W: H% d% z9 a6 y
% s' s# U" ]8 [8 ?* p; L
ceil(a)= [ 0, -2, 0, 1, 1, 2, 3, -1+3i]
r# e& ^# m# x, T7 t
2 M/ t/ B' Y2 A6 U& Y' l& sfix(a)= [ 0, -2, 0, 0, 0, 1, 2, -1+2i]* _! m n2 l+ Z" ^; n/ q3 b
0 T. |$ r2 Y: {' R4 U3 Wround(a)=[-1, -2, 0, 0, 1, 1, 3, -1+3i]0 N0 f6 i9 g* P# m/ o5 `- r! r, p
1 E9 E6 h6 t/ C8 H* Z注:For complex X, for all the four fuctions the imaginary and real parts are rounded independently
: D; R1 S9 U9 o, J. g* d7 t' l% w/ s! D6 i( }9 y& @2 t* J* Y/ h, |" n
3 l7 l4 r! v- |4 ? r; N T% P9 Y |6 D3 H" x1 }
|
|