matlab 中的abs函数什么意思 编程知识

如题所述

matlab中的abs(x)是去绝对值的函数
例如:x=-1.23
abs(x)
ans
1.23
以上即是取了-1.23的绝对值
此外,MATLAB中还有一些内置函数,可以直接调用
函数名 功能描述
acos(x) 计算arccos(x)的值
asin(x) 计算arcsin(x)的值
atan(x) 计算arctan(x)的值
atan2(y,x) 计算arctan(y/x)的值
cos(x) 计算余弦
exp(x) 计算e的x次方
mod(x,y) 计算余数
sqrt(x) 计算平方根
ceil(x) 向正无穷取整
fix(x) 向零取整
floor(x) 向负无穷取整
round(x) 四舍五入取整
Char(x) 将数字转换为字符(数字范围0~255)
Double(x) 将字符转换为数字
int2str(x) 将整型数字转换为字符
num2str(x) 将有小数的数字转换为字符
str2num(x) 数字转换为数字
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-23
其实如果想知道matlab中函数的作用,最好是help一下~,慢慢的你会发现它很强大的。help一下呗,事实证明你的确信是错的help absABS Absolute value. ABS(X) is the absolute value of the elements of X. When X is complex, ABS(X) is the complex modulus (magnitude) of the elements of X.这个就是它的作用,简单说就是求绝对值,比如ABS(-1) = 1,ABS(2) = 2。
第2个回答  2013-08-24
呵呵,其实如果想知道matlab中函数的作用,最好是help一下~,慢慢的你会发现它很强大的。help一下呗,事实证明你的确信是错的help absABS Absolute value. ABS(X) is the absolute value of the elements of X. When X is complex, ABS(X) is the complex modulus (magnitude) of the elements of X.这个就是它的作用,简单说就是求绝对值,比如ABS(-1) = 1,ABS(2) = 2。本回答被提问者采纳
第3个回答  2020-04-13
第4个回答  2016-05-19
matlab中abs(x)表示对x中的元素求绝对值,当x为复数时,表示该复数的幅值。
举例如下:
1、
>> abs(-3)

ans =

3

-3的绝对值为3
2、
>> abs([2,4,-5,-8,0-1])
ans =

2 4 5 8 1

求出每个元素的绝对值
3、

>> abs(2+i)
ans =

2.2361

求复数的幅值
相似回答