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. WPF多路绑定

    WPF多路绑定 多路绑定实现对数据的计算,XAML:   引用资源所在位置 xmlns:cmlib="clr-namespace:CommonLib;assembly=CommonLib&q ...

  2. Tomcat 配置上传文件到项目外的路径

    使用 Tomcat 作为服务器的时候,将上传文件保存在项目路径下,每次重启服务或者打成 war 包的时候很容易丢失上传的文件,于是我们配置 Tomcat 把文件保存到项目外的其他磁盘路径: 1. 打开 ...

  3. Vue中实现token验证

    前后端流程分析 前端页面进行登录操作,将用户名和密码发给服务器 服务器进行校验,通过后生成token,包含信息有密匙.uid.过期时间等,然后返回给前端 前端将token保存在本地(建议在localS ...

  4. Express开发性能优化

    1.使用浏览器缓存 在app.js里添加 var CACHETIME = 60 * 1000 * 60 * 24 * 30; app.use(express.static(path.join(__di ...

  5. Java8新特性--流(Stream)

    1.简介      Java 8是Java自Java 5(发布于2004年)之后的最重要的版本.这个版本包含语言.编译器.库.工具和JVM等方面的十多个新特性.在本文中我们一起来学习引入的一个新特性- ...

  6. sql基础语法大全 转载过来的,出处忘了!

    一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备 ...

  7. 第二节:Java开发环境的搭建

    一.认识并安装JDK 1.JDK(Java Development Kit)是Java开发工具集,包括Java运行环境(JRE).Java开发工具以及一些基础类库,进行Java开发所必须安装的软件. ...

  8. graphviz 的节点形状

    graphviz 的节点可以定义不同的外形,比如下面的定义, digraph tt1{     a[shape=box];     c[shape=lpromoter];     d[shape=do ...

  9. win32FTP程序设计

    掌握socket基于事件机制的网络程序设计,掌握多线程技术的FTP Server端设计方法,掌握FTP标准基本协议及其程序的实现,掌握文件内容的网络传输设计方法. 利用CFtpServer类接收和解析 ...

  10. Spring boot 入门二:Spring Boot配置文件详解

    一.自定义属性 当我们创建一个springboot项目的时候,系统默认会为我们在src/main/java/resources目录下创建一个application.properties.同时也支持ym ...