zoukankan      html  css  js  c++  java
  • Matlab -- floor函数的用法

    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
  • 相关阅读:
    Android布局1
    QML 自定义折线图
    QML ChartView 画折线图
    操作系统复习笔记
    Redis的使用
    Git的基本使用
    Python json to excel/csv
    .NET中进行Base64加密解密
    用 IIS 7、ARR 與 Velocity 建设高性能的大型网站
    微信突然出现redirect_uri 参数错误
  • 原文地址:https://www.cnblogs.com/zzzsj/p/14651976.html
Copyright © 2011-2022 走看看