导航:首页 > 使用方法 > matlab中函数的使用方法

matlab中函数的使用方法

发布时间:2025-03-17 07:06:23

Ⅰ matlab中round函数具体用法

round函数

函数功能:四舍五入取整。

使用方法:B = round(A)

对数组A中每个元素朝最近的方向取整数部分,并返回与A同维的整数数组B,对于一个复数参量A,则分别对其实部和虚数朝最近的方向取整数部分,并返回一复数数据B。

例子:

ceil(x)返回不小于x的最小整数值(然后转换为double型)。

floor(x)返回不大于x的最大整数值。

round(x)返回x的四舍五入整数值。

#include <stdio.h>

#include <math.h>

int main(int argc, const char *argv[])

{

float num = 1.4999;

printf("ceil(%f) is %f ", num, ceil(num));

printf("floor(%f) is %f ", num, floor(num));

printf("round(%f) is %f ", num, round(num));

return 0;

}

编译:$cc test.c -lm

执行:$./a.out

ceil(1.499900) is 2.000000

floor(1.499900) is 1.000000

round(1.499900) is 1.000000

Matlab中round()

应用举例:

a = [-1.9, -0.2, 3.4, 5.6, 7.0, 2.4+3.6i]

a =

Columns 1 through 4

-1.9000 -0.2000 3.4000 5.6000

Columns 5 through 6

7.0000 2.4000 + 3.6000i

round(a)

ans =

Columns 1 through 4

-2.0000 0 3.0000 6.0000

Columns 5 through 6

7.0000 2.0000 + 4.0000i

阅读全文

与matlab中函数的使用方法相关的资料

热点内容
给水管道预埋件安装方法 浏览:809
手机清理垃圾的方法用盐水 浏览:931
最实用的清理手机方法 浏览:583
小米网络哪里设置方法 浏览:461
用什么方法可以使胸变大 浏览:959
内蒙军人过渡性养老金计算方法 浏览:218
高泡地毯清洁剂使用方法 浏览:186
15x96用简便方法计算 浏览:123
抽象方法有两个实现如何调用 浏览:660
营养评定常用指标与方法有哪些 浏览:979
肌肉长期僵硬如何变软训练方法 浏览:613
句容过滤器安装方法 浏览:681
6的肝血管瘤治疗方法 浏览:421
用线连接电脑显示器的方法 浏览:691
买家具的技巧与方法 浏览:718
gta5的内存在哪里设置方法 浏览:575
腰部疱疹的治疗方法 浏览:622
西门子滤波计算方法 浏览:232
如何认识学习方法 浏览:946
治疗白斑最有效的方法是什么 浏览:297