Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 43457

Submitted on 17 Feb 2012 by Tim

Correct

103Size
Leading solution size is 89.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
[V1,V2] = balldrop_puzz(1.5,2.5,2,2,3.75,7);
assert(all(abs(V1-[-4.62546938906081,0])<1000*eps))
assert(all(abs(V2-[2.77528163343649,-9.45403544713895])<1000*eps))
v1 =
   -4.6255         0
v2 =
    2.7753   -9.4540
2
Pass
 
%%
[V1,V2] = balldrop_puzz(1.5,1.75,2,3.3,2.75,5)
assert(all(abs(V1-[-2.38857735374413,0])<1000*eps))
assert(all(abs(V2-[2.04735201749497 0.340314640435397])<1000*eps))
v1 =
   -2.3886         0
v2 =
    2.0474    0.3403
V1 =
   -2.3886         0
V2 =
    2.0474    0.3403
3
Pass
 
%%
[V1,V2] = balldrop_puzz(1.5,1.5,2,2,2.75,3)
assert(all(abs(V1-[-0.926482490085206,0])<1000*eps))
assert(all(abs(V2-[0.926482490085206,-0.387821095199846])<1000*eps))
v1 =
   -0.9265         0
v2 =
    0.9265   -0.3878
V1 =
   -0.9265         0
V2 =
    0.9265   -0.3878
4
Pass
 
%%
[V1,V2] = balldrop_puzz(3,1,4,2,2.75,7)
assert(all(abs(V1-[-1.45087063290465,0])<1000*eps))
assert(all(abs(V2-[4.35261189871394,2.7238062965565])<1000*eps))
v1 =
   -1.4509         0
v2 =
    4.3526    2.7238
V1 =
   -1.4509         0
V2 =
    4.3526    2.7238
5
Pass
 
%%
[V1,V2] = balldrop_puzz(1,7,2,1,1,4)
assert(all(abs(V1-[-11.8594824370299,0])<1000*eps))
assert(all(abs(V2-[1.69421177671855,0])<1000*eps))
v1 =
  -11.8595         0
v2 =
    1.6942    0.0000
V1 =
  -11.8595         0
V2 =
    1.6942    0.0000