Cody

Problem 274. Bouncing disk

Solution 2133825

Submitted on 19 Feb 2020
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   Fail
[x,y]=room_bounce(0,0,1,0,1,1,0.1); assert(isequal(round(x*1000)/1000,0.51)) assert(isequal(round(y*1000)/1000,0))

Error using min MIN with two matrices to compare and two output arguments is not supported. Error in room_bounce (line 15) [d,p]=min(dx/v(1),dy/v(2)); Error in Test1 (line 1) [x,y]=room_bounce(0,0,1,0,1,1,0.1);

2   Fail
[x,y]=room_bounce(0,0,1,0,0.5,1,0.1); assert(isequal(round(x*1000)/1000,0.49)) assert(isequal(round(y*1000)/1000,0))

Error using min MIN with two matrices to compare and two output arguments is not supported. Error in room_bounce (line 15) [d,p]=min(dx/v(1),dy/v(2)); Error in Test2 (line 1) [x,y]=room_bounce(0,0,1,0,0.5,1,0.1);

3   Fail
[x,y]=room_bounce(0.1,0,1,pi/4,0.1,1,0.1); assert(isequal(round(x*1000)/1000,0.061)) assert(isequal(round(y*1000)/1000,0.361))

Error using min MIN with two matrices to compare and two output arguments is not supported. Error in room_bounce (line 15) [d,p]=min(dx/v(1),dy/v(2)); Error in Test3 (line 1) [x,y]=room_bounce(0.1,0,1,pi/4,0.1,1,0.1);

4   Fail
[x,y]=room_bounce(0.1,0,10,pi/10,0.3,0.6,0.1); assert(isequal(round(x*1000)/1000,0.01)) assert(isequal(round(y*1000)/1000,0.155))

Error using min MIN with two matrices to compare and two output arguments is not supported. Error in room_bounce (line 15) [d,p]=min(dx/v(1),dy/v(2)); Error in Test4 (line 1) [x,y]=room_bounce(0.1,0,10,pi/10,0.3,0.6,0.1);

5   Fail
[x,y]=room_bounce(1,1,10,-pi/7,2,5,0.01); assert(isequal(round(x*1000)/1000,0.366)) assert(isequal(round(y*1000)/1000,0.219))

Error using min MIN with two matrices to compare and two output arguments is not supported. Error in room_bounce (line 15) [d,p]=min(dx/v(1),dy/v(2)); Error in Test5 (line 1) [x,y]=room_bounce(1,1,10,-pi/7,2,5,0.01);

Suggested Problems

More from this Author3

Community Treasure Hunt

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

Start Hunting!