An object leaves pointP1 with coordinates (−1,0) and travels with velocityv1=1 in a straight line to pointP2 with coordinates (0,h) . It then travels with velocityv2=2 in a straight line fromP2 to pointP3 with coordinates (x , y ).
Givenx andy values there will be some optimalh value that minimizes the total travel time. Write a program in Scilab containing a function in the form
function u = h(x,y)
[your code goes here]
endfunction
u = h(1,2);
disp(u);
that calculates this optimalh value (to an accuracy of about 10^−6 ) givenx andy values as arguments. Your function must work for any positive values ofx andy.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here