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 54511

Submitted on 1 Mar 2012

Incorrect

83Size
Leading solution size is 39.
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
 
%%
[P,L] = my_spiral(20,1/2);
assert(all(abs(P-[0.5859375,0.484375])<100*eps))
assert(all(abs(L-[0.571428571428571,0.428571428571429])<100*eps))

                    
2
Pass
 
%%
[P,L] = my_spiral(11,2/7);
assert(all(abs(P-[0.80841316118284,0.387755102040816])<100*eps))
assert(all(abs(L-[0.538461538461538,0.461538461538462])<100*eps))

                    
3
Pass
 
%%
[P,L] = my_spiral(88,9999/11111);
assert(all(abs(P-[0.652150333541218,0.358838287231673])<100*eps))
assert(all(abs(L-[0.645144433154304,0.354855566845696])<100*eps))

                    
4
Fail
 
%%
[P,L] = my_spiral(901,987654/1000000);
assert(all(abs(P-[0.666383724185262,0.337637121736288])<100*eps))
assert(all(abs(L-[0.663934355482405,0.336065644517595])<100*eps))
Error: Assertion failed.
5
Pass
 
%%
[P,L] = my_spiral(3,eps);
assert(all(abs(L-[1/2,1/2])<100*eps))

                    
6
Fail
 
%%
[P,L] = my_spiral(2,1-eps);
assert(all(abs(L-[2/3,1/3])<100*eps))
Error: Assertion failed.