Cody

Problem 661. Spot the outlier

Solution 470723

Submitted on 12 Jul 2014 by Abdullah Caliskan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% pts = [0 1; 0 2; 3 2; 0 3; 0 4 ]; outlier = 3; assert(isequal(spot_the_outlier(pts),outlier))

cevap = 3

2   Pass
%% pts = [10 -1;7 0;9.5 0.3;9 1.6;8.5 2.9]; outlier = 2; assert(isequal(spot_the_outlier(pts),outlier))

r = 1 2 3 4 5 R = 1.0000 0.2554 0.2554 1.0000 R = 1 -1 -1 1 R = 1.0000 -0.1760 -0.1760 1.0000 R = 1.0000 -0.2653 -0.2653 1.0000 R = 1.0000 -0.1744 -0.1744 1.0000

3   Pass
%% pts = [-0.6 -6;-0.2 0;0 3;-0.8 -9;-2 1;-0.4 -3]; outlier = 5; assert(isequal(spot_the_outlier(pts),outlier))

r = 1 2 3 4 5 6 R = 1.0000 0.0647 0.0647 1.0000 R = 1.0000 -0.0432 -0.0432 1.0000 R = 1.0000 -0.3060 -0.3060 1.0000 R = 1.0000 -0.0357 -0.0357 1.0000 R = 1 1 1 1 R = 1.0000 0.0555 0.0555 1.0000

4   Pass
%% pts = [2 5;0 4;0 0;4 6;-2 3]; outlier = 3; assert(isequal(spot_the_outlier(pts),outlier))

r = 1 2 3 4 5 R = 1.0000 0.6093 0.6093 1.0000 R = 1.0000 0.6831 0.6831 1.0000 R = 1 1 1 1 R = 1.0000 0.3780 0.3780 1.0000 R = 1.0000 0.7612 0.7612 1.0000

5   Pass
%% pts = [1 0; 0 1; 1 2; 1.5 2.5; 2 3; 3 4 ]; outlier = 1; assert(isequal(spot_the_outlier(pts),outlier))

r = 1 2 3 4 5 6 R = 1 1 1 1 R = 1.0000 0.8461 0.8461 1.0000 R = 1.0000 0.8402 0.8402 1.0000 R = 1.0000 0.8321 0.8321 1.0000 R = 1.0000 0.8126 0.8126 1.0000 R = 1.0000 0.6719 0.6719 1.0000

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!