比如这个向量是冲睁A=[1,3,-6,8,-5,3,2,4,9,7];
用如下命令即散中岁培握可:
max(abs(A))
做个例子,辩谨历希望有携搜所帮助晌绝。
代码
% By lyqmath
clc; clear all; close all;
data = 100*randn(10, 1)
data(abs(data)==max(abs(data)))
结果
data =
160.3946
9.8348
4.1374
-73.4169
-3.0814
23.2347
42.6388
-37.2809
-23.6455
202.3691
ans =
202.3691
>>
>> a = [2 3 -5 3 23 -66 5 -9];
[mx,id] = max(abs(a));
aaMax = a(id)
aaMax =
-66