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
regexp hack
regexp hack
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.
regexp hack
I like this solution
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.
Make the vector [1 2 3 4 5 6 7 8 9 10]
30360 Solvers
Find the longest sequence of 1's in a binary sequence.
2528 Solvers
162 Solvers
Sum the entries of each column of a matrix which satisfy a logical condition.
114 Solvers
977 Solvers