suppose you go from x-y-z coordinates [3,4,2] to [0,0,2] to [0,1,2] to [1,1,2], to [1,1,20] then you walked 25 units of distance.
If input xyz =[3 4 2; 0 0 2; 0 1 2; 1 1 2; 1 1 20] then output w=25.
Very nice !
please explain the problem
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.
I like this solution
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.
Reverse the Words (not letters) of a String
Check if any duplicates in your data
Multiply a column by a row
Dick Van Dyck?
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office