-
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.
Suggested Problems
-
2283 Solvers
-
530 Solvers
-
Sum of first n positive integers
592 Solvers
-
07 - Common functions and indexing 3
417 Solvers
-
526 Solvers
More from this Author100
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!