• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Matlab--floor函数的用法

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1、floor函数:朝负无穷大方向取整

2、用法说明:

      y = floor(x) 函数将x中元素取整,值y为不大于本身的最大整数。对于复数,分别对实部和虚部取整

3、用法举例

例1:

>> x = [3+4i 6-7i 9+11i 1-4i 3.4-4.5i 90.67-123i]

x =

   1.0e+02 *

  Columns 1 through 5

   0.0300 + 0.0400i   0.0600 - 0.0700i   0.0900 + 0.1100i   0.0100 - 0.0400i   0.0340 - 0.0450i

  Column 6

   0.9067 - 1.2300i

>> y = floor(x)

y =

   1.0e+02 *

  Columns 1 through 5

   0.0300 + 0.0400i   0.0600 - 0.0700i   0.0900 + 0.1100i   0.0100 - 0.0400i   0.0300 - 0.0500i

  Column 6

   0.9000 - 1.2300i

例2:

 

>> a= 2*rand(4)

a =

    1.9298    0.9708    1.8315    0.0714
    0.3152    1.6006    1.5844    1.6983
    1.9412    0.2838    1.9190    1.8680
    1.9143    0.8435    1.3115    1.3575

>> x = floor(a)

x =

     1     0     1     0
     0     1     1     1
     1     0     1     1
     1     0     1     1


>> b = floor(a + rand(4)*i)


b =

     2     1     3     0
     1     2     2     1
     3     1     3     2
     2     2     2     3

 

4、附录

>> help floor
 floor  Round towards minus infinity.
    floor(X) rounds the elements of X to the nearest integers
    towards minus infinity.
 
    See also round, ceil, fix.

    Overloaded methods:
       codistributed/floor
       gpuArray/floor

    Reference page in Help browser
       doc floor

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi公用函数单元-YzDelphiFunc发布时间:2022-07-18
下一篇:
Delphi的程序单元发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap