floor:朝负无穷方向舍入
B = floor(A) rounds the elements of A to the nearest integers less than or equal to A.
 
ceil:朝正无穷方向舍入 
B = ceil(A) rounds the elements of A to the nearest integers greater than or equal to A.
 
fix:朝零方向舍入 
B = fix(A) rounds the elements of A toward zero, resulting in an array of integers.
 
round:四舍五入 
B = round(A) rounds the elements of X to the nearest integers.  
 
Example:

a=       [-0.9,  -2.1,  -0.4,  0.3,  0.8,  1.1,  2.7,  -1.2+2.9i];

floor(a)=[ -1,    -3,    -1,    0,    0,    1,    2,     -2+2i]

ceil(a)= [ 0,     -2,     0,    1,    1,    2,    3,     -1+3i]

fix(a)=  [ 0,     -2,     0,    0,    0,    1,    2,     -1+2i]

round(a)=[-1,     -2,     0,    0,    1,    1,    3,     -1+3i]

注:For complex X, for all the four fuctions the imaginary and real parts are rounded independently.
 

关于Matlab里面的四个取整(舍入)函数:Floor, Ceil, Fix, Round的解释(转)的更多相关文章

  1. Matlab中的取整-floor,ceil,fix,round

    FLOOR Round towards minus infinity. FLOOR(X) rounds the elements of X to the nearest integers toward ...

  2. java的四种取整方法

    java 中取整操作提供了四种方法:分别是: public static double ceil(double a)//向上取整  public static double floor(double ...

  3. js 小数取整的函数

    1.丢弃小数部分,保留整数部分 js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(7/2) 3,四舍五入. js: Math.round(7/2) 4, ...

  4. js 中小数取整的函数

    1.丢弃小数部分,保留整数部分 js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(7/2) 3,四舍五入. js: Math.round(7/2) 4, ...

  5. JS中对小数取整的函数,向上(下),四舍五入取整

    1.丢弃小数部分,保留整数部分 js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(7/2) 3,四舍五入. js: Math.round(7/2) 4, ...

  6. JS对象 向上取整ceil() ceil() 方法可对一个数进行向上取整。 语法: Math.ceil(x) 注意:它返回的是大于或等于x,并且与x最接近的整数。

    向上取整ceil() ceil() 方法可对一个数进行向上取整. 语法: Math.ceil(x) 参数说明: 注意:它返回的是大于或等于x,并且与x最接近的整数. 我们将把 ceil() 方法运用到 ...

  7. C/C++四种取整函数floor,ceil,trunc,round

    处理浮点数操作常用到取整函数,C/C++提供了四种取整函数 floor函数 floor函数:向下取整函数,或称为向负无穷取整 double floor(double x); floor(-5.5) = ...

  8. iOS 常用的向上,向下取整, 四舍五入函数

    向上取整:ceil(x),返回不小于x的最小整数; 向下取整:floor(x),返回不大于x的最大整数; 四舍五入:round(x) 截尾取整函数:trunc(x)  

  9. js只保留整数,向上取整,四舍五入,向下取整等函数

    1.丢弃小数部分,保留整数部分 parseInt(5/2) 2.向上取整,有小数就整数部分加1 Math.ceil(5/2) 3.四舍五入. Math.round(5/2) 4.向下取整 Math.f ...

随机推荐

  1. Linux 64位 CentOS下安装 Docker 容器,启动、停止

    一.Docker简介 Docker 提供了一个可以运行你的应用程序的封套(envelope),或者说容器,是轻量级的“容器引擎+映像仓库”,在LXC(linux轻量级容器)的基础上构建,可以运行任何应 ...

  2. [uva] 1671 History of Languages

    题目描述 输入两个DFA,判断是否等价. https://uva.onlinejudge.org/external/16/1671.pdf 输入 第一行T 可以接受的字母表 第二行N 状态数 接下去N ...

  3. awk统计文件中某关键词出现次数

    1.统计文件test.txt中第2列不同值出现的次数 awk '{sum[$2]+=1}END{for(i in sum)print i"\t"sum[i]}'  test.txt ...

  4. sql中替换换行符和空格的示例

    select DiscussID,L.Name as LocationName , C.Name as ClientName, REPLACE(BrandName,' ','') BrandName ...

  5. 转载:SQL按照日、周、月、年统计数据的方法

    转载源:http://www.jb51.net/article/42613.htm SQL按照日.周.月.季度.年统计数据的方法 方式一: --按日 select sum(consume),day([ ...

  6. [android] 手机卫士黑名单功能(ListView优化)

    上一篇记录了使用ListView展示出来了100条数据,当慢慢拖动的时候,不会有问题,但是当拖动很快的时候,应用会报anr错误 查看错误日志,看到报OutOfMemoryError,内存不足 List ...

  7. Hive配置文件hive-site.xml

    <configuration> <property> <name>hive.metastore.warehouse.dir</name> <val ...

  8. 线程8--GCD常见用法

    1.延迟执行 /***********************延迟第一种方法**************************/ /* 第一种方法, 调用NSObject的方法 [self perf ...

  9. 撩课-Web大前端每天5道面试题-Day19

    1.实现一个函数clone,可以对JavaScript中的5种主要的数据类型(包括Number.String.Object.Array.Boolean)进行值复制 考察点1:对于基本数据类型和引用数据 ...

  10. 【PyQt5 学习记录】011:使用 QListWidet 创建列表

    使用 QListWidet 创建列表 作者: 八月未见 博客: https://www.cnblogs.com/jmtm/ 创建列表: list_widget = QListWidget() 插入项目 ...