More easy that it seems.
You need to specify "Euclidean" distance :-)
Good problem, not too hard but required thinking
Please add the next test :
p = [0,0;
2,1;
2,6;
1,6];
ix_correct = [1 3];
assert(isequal(mostDistant(p),ix_correct))
The solutions of the form:
[~,indx]=max(dist(p'));
unique(indx)
will fail, the last line will return an extra index [1,3,4] instead of just [1,3]
refer to
Convex Hull therom and the Graham's Scan method
+1
hehe, just trying to see if they have any hidden tests for the code.
Since yesterday, I submit the solution ,and it always shows "
While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore."
I don't know how to deal with it?
You should be able to submit solutions now. Sorry for the inconveniene.
no function squareform either... pffff
Cody utilizes vanilla MATLAB (no toolboxes).
Why is there "undefined function 'dist' for input arguments of type 'double'."? Works on my machine (and online matlab too)
I solved the problem by an tedious approach.
remove ' diff ',but adds size -_-
:)))))
I am using matlab2010 but dist function is not available in it. Can you tell me how and where can I use this?
Without dist, but with str2num
I think it works w/ just x*[1;i] . No need to convert from a string.
i'm not sure this can always get the right answer,
so i need more debugging.
what is 'i'? This is strange but works.
@Claudia, "i" is the imaginary number sqrt(-1). Unless you overwrite it, it's always available to you in MATLAB without needing to declare it.
Excuse me?
This solution works fine, but requires the stats toolbox to function!
I dont get whay sort(unique(ix)) will give you the location of the two points. it is wrong for these points (0.9631 0.5468),(0.5211 0.2316),(0.4889,0.6241),(0.6791 0.3955),(0.3670 0.9890),
sort(unique(ix)) will return [1 2 5].
I think this solution is not right
I agree.
there may be something out of word,
if i put:
p =[1 0; 0 1;0 0; 1/sqrt(2) 1/sqrt(2) ]
your command would not right,
but 'unique' is very admirable.
This is the smallest solution not to use "dist," which is not in core Matlab. Nicely done!
I don't know why Cody allows answers which depend on toolboxes. The whole point should be to write one's own "distance" function.
Hard to believe you let 'dist' in but not 'pdist'.
pdist is not allowed!
I find this a little bit unfair: dist is a neural network toolbox function. It is not available in MATLAB core, and the problem does not specify this toolbox is needed.
Shame on me...
Count from 0 to N^M in base N.
220 Solvers
Determine if a Given Number is a Triangle Number
335 Solvers
Project Euler: Problem 2, Sum of even Fibonacci
1194 Solvers
Back to basics 17 - white space
249 Solvers
Given a matrix, swap the 2nd & 3rd columns
620 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!