Cody

Solution 439531

Submitted on 7 May 2014 by Axel
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))

s = R: [2x2 double] df: 2 normr: 2.2156 s = R: [2x2 double] df: 2 normr: 2.5100 s = R: [2x2 double] df: 2 normr: 0 ans = 3 s = R: [2x2 double] df: 2 normr: 2.5752 s = R: [2x2 double] df: 2 normr: 2.5981

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))

s = R: [2x2 double] df: 2 normr: 1.8088 s = R: [2x2 double] df: 2 normr: 1.7764e-15 ans = 2 s = R: [2x2 double] df: 2 normr: 2.1313 s = R: [2x2 double] df: 2 normr: 2.2092 s = R: [2x2 double] df: 2 normr: 2.2427

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))

s = R: [2x2 double] df: 3 normr: 1.5866 s = R: [2x2 double] df: 3 normr: 1.5059 s = R: [2x2 double] df: 3 normr: 1.3464 s = R: [2x2 double] df: 3 normr: 1.5839 s = R: [2x2 double] df: 3 normr: 1.1776e-16 ans = 5 s = R: [2x2 double] df: 3 normr: 1.5622

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

s = R: [2x2 double] df: 2 normr: 3.4564 s = R: [2x2 double] df: 2 normr: 3.2660 s = R: [2x2 double] df: 2 normr: 4.2596e-15 ans = 3 s = R: [2x2 double] df: 2 normr: 2.6186 s = R: [2x2 double] df: 2 normr: 2.1509

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))

s = R: [2x2 double] df: 3 normr: 2.7733e-15 ans = 1 s = R: [2x2 double] df: 3 normr: 0.8919 s = R: [2x2 double] df: 3 normr: 1.2127 s = R: [2x2 double] df: 3 normr: 1.2649 s = R: [2x2 double] df: 3 normr: 1.2769 s = R: [2x2 double] df: 3 normr: 1.0986