How to find a corresponding matrix value
Afficher commentaires plus anciens
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
Plus de réponses (0)
Catégories
En savoir plus sur Sparse Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!