abs在MATLAB的作用
来源:百度知道 编辑:UC知道 时间:2024/06/06 11:16:48
这里的c不是一个数 而是一个向量 我确信它不是求绝对值
abs()函数就是求绝对值的。
abs函数
头文件:stdlib math|
用 法: int abs(int i);
程序例:
#include <stdlib.h>
#include <stdio.h>
#include<math.h>
int main(void)
{
int number = -1234;
printf("number: %d absolute value: %d\n", number, abs(number));
return 0;
}
在C语言中还有fabs,也是求绝对值的。(Java语言中有类似的作用。)
Function Abs( X : Real ) : Longint;
功 能: 求数的绝对值
例:
Begin
{ 语句; { ( X数据类型 ) 输出结果 } }
Writeln( Abs(-111222333) ); {(Longint) 111222333 }
Writeln( Abs(-1112223334324445556) ); {(Int64) 1112223334324445556 }
End.
Matlab
求复数实部与虚部的平方和的算术平方根
格式:abs(x)
例如:x=1+j;
y=abs(x);
>>y=1.4142
help一下呗,事实证明你的确信是错的
help abs
ABS 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