MATLAB Answers

## How to find a corresponding matrix value

Asked by Synthia Caruvana

### Synthia Caruvana (view profile)

on 4 Apr 2019
Latest activity Commented on by Synthia Caruvana

### Synthia Caruvana (view profile)

on 4 Apr 2019
Accepted Answer by Torsten

### Torsten (view profile)

I have two matricies, y and t, and I calculated the values of t from the values of y. I then found the minimum value of t, but I also need to find the corresponding value of y from the other matrix and I'm not sure how to do that. So what I have is:
% Creating a vector of y-values
y = [20:.5:48];
% Inputting values of constants
Vr = 3;
Vs = 1;
L = 48;
ds = 30;
dw = 42;
% Calculating the total travel time for each y-value
tr = sqrt(y.^2+ds^2)/Vr;
ts = sqrt((L-y).^2+dw^2)/Vs;
t = tr + ts;
% Finding the minimum value of t
min(t)
So now I know that 59.2946 is the shortest amount of time, but I don't know how to find the corresponding y value.

#### 0 Comments

Sign in to comment.

## 1 Answer

Answer by Torsten

### Torsten (view profile)

on 4 Apr 2019
Edited by Torsten

on 4 Apr 2019
Accepted Answer

[M I] = min(t);
y(I)

Synthia Caruvana

### Synthia Caruvana (view profile)

on 4 Apr 2019
Thanks!

Sign in to comment.