Problem 255. Spiraling out of control....

Solution 596707

Submitted on 16 Mar 2015 by Binbin Qi
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
%% [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   Pass
%% [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))

5   Pass
%% [P,L] = my_spiral(3,eps); assert(all(abs(L-[1/2,1/2])<100*eps))

6   Pass
%% [P,L] = my_spiral(2,1-eps); assert(all(abs(L-[2/3,1/3])<100*eps))

Suggested Problems

More from this Author6

Community Treasure Hunt

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

Start Hunting!