How to find a corresponding matrix value

3 vues (au cours des 30 derniers jours)
Synthia Caruvana
Synthia Caruvana le 4 Avr 2019
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.

Réponse acceptée

Torsten
Torsten le 4 Avr 2019
Modifié(e) : Torsten le 4 Avr 2019
[M I] = min(t);
y(I)

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by