MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply TodayCorrect

13Size

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.

1 player likes this solution

Test

Code Input and Output

1

Pass

m=5; Start=rand(m,2); Final=rand(m,2); d=xy_distance(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))

3 Comments