Cody

Solution 408423

Submitted on 23 Feb 2014 by J.R.! Menzinger
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
%% filetext = fileread('xy_dstnc.m'); assert(isempty(strfind(filetext, 'dist')))
2   Pass
%% m=5; Start=rand(m,2); Final=rand(m,2); d=xy_dstnc(Start,Final); d=round(100*d)/100; d_expect=zeros(m); for i=1:m % 10 for j=1:m dx=Start(i,1)-Final(j,1); % 14 dy=Start(i,2)-Final(j,2); % 14 d_expect(i,j)=hypot(dx,dy); % 14 end end d_expect=round(100*d_expect)/100; assert(isequal(d_expect,d))
b = 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 a = 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 ans = 0.7241 0.3642 0.4902 0.6772 0.7080 0.9938 0.2673 0.3636 0.7014 0.0857 0.3029 0.6569 0.4066 0.0631 0.7708 0.0682 0.8911 0.6995 0.4171 1.0874 0.7917 0.5276 0.3198 0.4352 0.3906