2013-10-14 96 views

回答

3

max命令返回max元素的索引作爲第二個參數。
所以,如果你有三個vecotrs代表velocitydistancetime同樣大小的,您可以簡單:

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

假設,

>> 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)