Cody

Solution 2187801

Submitted on 2 Apr 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
nterms = 10; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; 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

[Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.] [> In find_error (line 5) In ScoringEngineTestPoint1 (line 8) In solutionTest (line 3)]

Index exceeds the number of array elements (0). Error in find_error (line 8) if refsequence(i)==errorsequence(i) Error in Test1 (line 8) [errorposition, truesequence] = find_error(errorsequence);

2   Fail
nterms = 201; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; for position = 1:10: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

[Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.] [> In find_error (line 5) In ScoringEngineTestPoint2 (line 8) In solutionTest (line 5)]

Index exceeds the number of array elements (0). Error in find_error (line 8) if refsequence(i)==errorsequence(i) Error in Test2 (line 8) [errorposition, truesequence] = find_error(errorsequence);

Suggested Problems

More from this Author9