2013-10-14 2 views
-5

속도, 거리 및 시간 배열이있는 경우와 같이 여러 배열이있는 경우. 속도의 최고치와 거리 및 시간을 어떻게 찾을 수 있습니까?Matlab에서 최대 찾기

답변

3

max 명령은 두 번째 인수로 max 요소의 인덱스를 반환합니다. 세 vecotrs velocity, distancetime을 대표하는 같은 크기의 이있는 경우
그래서, 당신은 간단하게 할 수 있습니다

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