Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Matlab中求Max_Matlab_Max - Fatal编程技术网

在Matlab中求Max

在Matlab中求Max,matlab,max,Matlab,Max,如果有多个数组,例如速度、距离和时间数组。我如何找到最大速度以及发生的距离和时间 命令将max元素的索引作为第二个参数返回。 因此,如果您有三个相同大小的向量,表示速度、距离和时间,您可以简单地: >> [mxv ii] = max( velocity ); % find max speed and its index >> [distance(ii), time(ii)] % distance and time corresponding to max velocity

如果有多个数组,例如速度、距离和时间数组。我如何找到最大速度以及发生的距离和时间

命令将max元素的索引作为第二个参数返回。
因此,如果您有三个相同大小的向量,表示
速度
距离
时间
,您可以简单地:

>> [mxv ii] = max( velocity ); % find max speed and its index
>> [distance(ii), time(ii)] % distance and time corresponding to max velocity
假设

>> distance = [1:5]; % any array
>> time=[11:15];% any array
>> speed=distance./time;
>> [max_speed,index]=max(speed);



% max_speed Occurred at time(index), distance(index)