Problem 117. Distance walked 3D
Solution Stats
Problem Comments
-
2 Comments
Very nice !
please explain the problem
Solution Comments
-
1 Comment
regexp hack
-
1 Comment
regexp hack
-
3 Comments
I am puzzled by the function you had used here (and also used in Solution 116288). It is no longer working on Cody (see Solution 1461162), and I cannot find documentation for it (except in a Toolbox — both by 'manual' online searching and using the "help" command). Is it a built-in function that's been removed, or perhaps part of a demo?
The dist function I have available now is located at C:\Program Files\MATLAB\R2016b\toolbox\nnet\nnet\nndistance\dist.m
Maybe it's no longer there in R2017b (Cody, at this moment), or the neural networking toolbox was available back then, and not now in Cody. I don't know.
Thanks. It seems indeed the "dist" function was previously available on Cody ...even though it "shouldn't have worked" (because it is & was part of a Toolbox). See comment by Ned Gully on 13 Feb 2014 at Problem 317.
-
1 Comment
regexp hack
-
1 Comment
I like this solution
-
3 Comments
Brilliant!
Can you explain the problem. Walking from [3 4 2] to [0 0 2] gives (3-0)+(4-0) = 7 units. Then from [0 0 2] to [0 1 2] gives 1 unit. From [0 1 2] to [1 1 2] gives 1 unit and finally from [1 1 2] to [1 1 20] gives 18 units. So sum of distance is 7+1+1+18 = 27. Is it right?
Walking from [3 4 2] to [0 0 2] is the same as walking DIRECT (along a 'diagonal') from the FIRST point that is 3 metres East, 4 metres North and 2 metres Elevated from the Origin to a SECOND point that is 0 metres East, 0 metres North and 2 metres Elevated from the Origin. As the Elevation hasn't changed in this leg of the trip, the distance reduces to the length of the hypotenuse of a right-angled triangle whose other sides are 3m and 4m, namely a length of 5 metres.
Problem Recent Solvers267
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
41411 Solvers
-
3325 Solvers
-
321 Solvers
-
Matrix indexing with two vectors of indices
589 Solvers
-
Arrange vector in ascending order
694 Solvers
More from this Author100
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!