Cody

Solution 1695862

Submitted on 19 Dec 2018
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
nterms = 10; term0 = randi(10) ratio = (-1)^randi(2)*randi(10) correctsequence = term0*ratio.^(0:nterms-1); for position = 1:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 1 at position %d', position); end

term0 = 8 ratio = -7 errorseq = -20 -56 392 -2744 19208 -134456 941192 -6588344 46118408 -322828856 most = -7

Undefined function or variable 'errorpos'. Error in find_error (line 7) errpos = find(r~=most); errorpos = errorpos(1)+(length(errorpos)>1); Error in Test1 (line 8) [errorposition, truesequence] = find_error(errorsequence);

2   Fail
nterms = 15; term0 = randi(10) ratio = (-1)^randi(2)*randi(10) correctsequence = term0*ratio.^(0:nterms-1); for position = 1:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 2 at position %d', position); end

term0 = 4 ratio = 10 errorseq = 1.0e+14 * -0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0004 0.0040 0.0400 0.4000 4.0000 most = 10

Undefined function or variable 'errorpos'. Error in find_error (line 7) errpos = find(r~=most); errorpos = errorpos(1)+(length(errorpos)>1); Error in Test2 (line 8) [errorposition, truesequence] = find_error(errorsequence);

Suggested Problems

More from this Author9