matlab 神经识别取整数_Matlab取整

本文详细介绍了Matlab中的取整函数,包括fix、floor、ceil和round,以及如何在小数点后某一位进行四舍五入。此外,还讨论了在Matlab中进行文本输出的方法,如disp和fprintf函数的使用。
摘要由CSDN通过智能技术生成

Matlab取整函数有: fix, floor, ceil, round.取整函数在编程时有很大用处。一、取整函数1.向零取整(截尾取整)fix-向零取整(Round towards zero);>> fix(3.6)   ans =     32.向负无穷取整(不超过x 的最大整数-高斯取整)floor-向负无穷取整(Round towards minus infinity);>> floor(-3.6)  ans =    -43.向正无穷取整(大于x 的最小整数)ceil-向正无穷取整(Round towards plus infinity);>> ceil(-3.6)   ans =    -34.向最近整数取整,四舍五入(四舍五入取整)round-向最近整数取整,四舍五入(Round towards nearest integer);>> round(3.5)ans =     4二、在小数点后某一位四舍五入,即保留几位小数,也经常用到。1.数值型roundn—任意位位置四舍五入>>a=123.4567890;>>a=roundn(a,-4)a =  123.4568其中roundn函数功能如下:   ROUNDN  Round numbers to specified power of 10   y = ROUNDN(x) rounds the input data x to the nearest hundredth.   %不指定n,精确到百分位   y = ROUNDN(x,n) rounds the input data x at the specified power    %精确到小数点后指定位数n   of tens position.  For example, n = -2 rounds the input data to   the 10E-2 (hundredths) position.2.符号型digi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值