Cody

Solution 529375

Submitted on 15 Nov 2014 by Yalong Liu
  • Size: 47
  • This is the leading solution.
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
coords = [ 47.7891 -103.074 47.7885 -103.051 47.7598 -103.055 47.76 -103.055 47.761 -103.055]; dist_correct = [ 0.00000 1.06856 2.20846 2.19580 2.13270 1.06856 0.00000 1.99178 1.97802 1.90924 2.20846 1.99178 0.00000 0.01382 0.08292 2.19580 1.97802 0.01382 0.00000 0.06910 2.13270 1.90924 0.08292 0.06910 0.00000]; assert(abs(sum(sum((procGPS(coords)-dist_correct))))<0.005*max(max(dist_correct)))

ans = @(x)sind(bsxfun(@minus,x,x')/2).^2

2   Pass
%% coords = [ 48.9803 -103.808 48.98031 -103.808 48.9806 -103.765 48.9806 -103.764 48.9534 -103.743 48.9809 -103.785 48.9822 -103.802 48.2269 -102.295 48.2559 -102.337 48.2556 -102.311 48.2557 -102.36 48.2557 -102.359 48.9818 -103.231 48.8639 -103.507 48.8804 -103.51 48.8648 -103.529 48.7935 -103.401 48.8379 -103.715 48.63282 -103.492268]; dist_correct = [ 0 0.000690976 1.950155232 1.995502612 3.485510848 1.043867842 0.302111766 86.53754762 83.78510566 84.75282145 82.9534702 82.98989215 26.16671135 15.85736704 15.18721355 14.97174021 22.55114901 10.70767068 27.98081693 0.000690976 0 1.950147814 1.995495354 3.485879124 1.043840523 0.301812113 86.53795777 83.78551307 84.75322419 82.95388198 82.99030374 26.16670599 15.85771634 15.18752642 14.97210747 22.55154299 10.70830547 27.98140911 1.950155232 1.950147814 0 0.045349749 2.12797696 0.907229104 1.681552044 84.98895345 82.23092177 83.18867303 81.40875472 81.44476589 24.21656659 14.22106846 13.48832542 13.37289322 20.99166378 10.11831281 27.04659437 1.995502612 1.995495354 0.045349749 0 2.107084218 0.95256744 1.726805519 84.95285272 82.19469683 83.15221287 81.37275326 81.40875472 24.17121793 14.18369356 13.44938704 13.33654253 20.95588696 10.10821786 27.0257419 3.485510848 3.485879124 2.12797696 2.107084218 0 2.690817215 3.335092424 83.06183212 80.30813598 81.2738957 79.47857211 79.5149 23.3078386 12.37415418 11.72088759 11.48623566 19.06975001 8.0814959 24.91872689 1.043867842 1.043840523 0.907229104 0.95256744 2.690817215 0 0.776146592 85.72532328 82.96973548 83.93198388 82.14329292 82.17948968 25.12340423 14.98902476 14.28513822 14.12265973 21.72709198 10.37975791 27.49426357 0.302111766 0.301812113 1.681552044 1.726805519 3.335092424 0.776146592 0 86.39692438 83.64318272 84.6086705 82.81365124 82.8499822 25.89393315 15.69097514 15.00598099 14.81325771 22.40402258 10.72506046 27.95475568 86.53754762 86.53795777 84.98895345 84.95285272 83.06183212 85.72532328 86.39692438 0 2.784056299 2.115378101 3.592699243 3.55447642 67.45150094 70.78812687 71.60197135 71.61685609 63.99904083 77.48346607 61.64286707 83.78510566 83.78551307 82.23092177 82.19469683 80.30813598 82.96973548 83.64318272 2.784056299 0 1.196326277 1.058218953 1.012217459 64.67828567 68.02660818 68.83652677 68.85826762 61.24275477 74.76787565 59.00989918 84.75282145 84.75322419 83.18867303 83.15221287 81.2738957 83.93198388 84.6086705 2.115378101 1.196326277 0 2.254291389 2.20828588 65.45050761 68.97840161 69.77964632 69.81586121 62.20537972 75.78431266 60.09066956 82.9534702 82.95388198 81.40875472 81.37275326 79.47857211 82.14329292 82.81365124 3.592699243 1.058218953 2.254291389 0 0.046005686 64.03108715 67.21123856 68.02924605 68.03734456 60.41790968 73.89077428 58.07210156 82.98989215 82.99030374 81.44476589 81.40875472 79.5149 82.17948968 82.8499822 3.55447642 1.012217459 2.20828588 0.046005686 0 64.05947669 67.24693201 68.06459108 68.07327999 60.45399813 73.92914571 58.11306589 26.16671135 26.16670599 24.21656659 24.17121793 23.3078386 25.12340423 25.89393315 67.45150094 64.67828567 65.45050761 64.03108715 64.05947669 0 14.94634989 14.47399026 15.76107662 15.13093723 24.12471833 26.88548218 15.85736704 15.85771634 14.22106846 14.18369356 12.37415418 14.98902476 15.69097514 70.78812687 68.02660818 68.97840161 67.21123856 67.24693201 14.94634989 0 1.148233919 1.001951244 6.849226939 9.626393279 15.9811711 15.18721355 15.18752642 13.48832542 13.44938704 11.72088759 14.28513822 15.00598099 71.60197135 68.83652677 69.77964632 68.02924605 68.06459108 14.47399026 1.148233919 0 1.381147146 7.786547077 9.771067867 17.1262391 14.97174021 14.97210747 13.37289322 13.33654253 11.48623566 14.12265973 14.81325771 71.61685609 68.85826762 69.81586121 68.03734456 68.07327999 15.76107662 1.001951244 1.381147146 0 7.627064455 8.658757412 16.11638162 22.55114901 22.55154299 20.99166378 20.95588696 19.06975001 21.72709198 22.40402258 63.99904083 61.24275477 62.20537972 60.41790968 60.45399813 15.13093723 6.849226939 7.786547077 7.627064455 0 14.61255215 11.85676168 10.70767068 10.70830547 10.11831281 10.10821786 8.0814959 10.37975791 10.72506046 77.48346607 74.76787565 75.78431266 73.89077428 73.92914571 24.12471833 9.626393279 9.771067867 8.658757412 14.61255215 0 17.43086334 27.98081693 27.98140911 27.04659437 27.0257419 24.91872689 27.49426357 27.95475568 61.64286707 59.00989918 60.09066956 58.07210156 58.11306589 26.88548218 15.9811711 17.1262391 16.11638162 11.85676168 17.43086334 0]; assert(abs(sum(sum((procGPS(coords)-dist_correct))))<0.005*max(max(dist_correct)))

ans = @(x)sind(bsxfun(@minus,x,x')/2).^2