Problem 661. Spot the outlier
Solution Stats
Problem Comments

2 Comments
The instructions were a bit confusing at first. It would have been better to say "Find the row number of the outlying point."
Also, using the third row as an answer and a 3 in a column of zeros makes it seem like the intent was to provide unclear instructions. (Or they are just used to writing college textbooks ;) )
The test set cases 2,3 seems to have two outliers for each case. Please check it
Solution Comments

1 Comment
Uses the formula for perpendicular distance of a point to a line when the line is not axis orthogonal.

2 Comments
Very interesting, why the test# 3 is not passed. It turned out that the two number
(x4x1)*(y2y1) is not the same as (y4y1)*(x2x1) due to floating point. I have to compare the subtraction with 10*eps.
Very interesting. I could not understand why I had not passed the test# 3. It turned out that the two number (x4x1)*(y2y1) and (y4y1)*(x2x1) are not the same due to floating point. My choice is to compare the absolute difference with 10*eps.

1 Comment
I'll try to improve it!

1 Comment
all tests are solved test3, i don't know what is the problem

2 Comments
I'm sorry for this :(
I got it on solution 600827.
http://www.mathworks.com/matlabcentral/cody/problems/661spottheoutlier/solutions/600827

1 Comment
great solution

1 Comment
Doesn't work with outlier in first position.

1 Comment
Could have been MUCH smaller, but corrcoef doesn't like x=0 the first test case.
Problem Recent Solvers418
Suggested Problems

What is the next step in Conway's Life?
909 Solvers

278 Solvers

Compute a dot product of two vectors x and y
818 Solvers

4420 Solvers

Calculate Amount of Cake Frosting
13018 Solvers
More from this Author50
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!