How to find a corresponding matrix value
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!