Cody

Solution 2167474

Submitted on 20 Mar 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

truesq = 7 5 3 1 1 -1 -3 -5 -7 -9 -11 ans = 1×10 logical array 1 0 0 0 0 0 0 0 0 0

Output argument "err" (and maybe others) not assigned during call to "find_error". 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

truesq = Columns 1 through 30 9 5 1 -3 -3 -7 -11 -15 -19 -23 -27 -31 -35 -39 -43 -47 -51 -55 -59 -63 -67 -71 -75 -79 -83 -87 -91 -95 -99 -103 Columns 31 through 60 -107 -111 -115 -119 -123 -127 -131 -135 -139 -143 -147 -151 -155 -159 -163 -167 -171 -175 -179 -183 -187 -191 -195 -199 -203 -207 -211 -215 -219 -223 Columns 61 through 90 -227 -231 -235 -239 -243 -247 -251 -255 -259 -263 -267 -271 -275 -279 -283 -287 -291 -295 -299 -303 -307 -311 -315 -319 -323 -327 -331 -335 -339 -343 Columns 91 through 120 -347 -351 -355 -359 -363 -367 -371 -375 -379 -383 -387 -391 -395 -399 -403 -407 -411 -415 -419 -423 -427 -431 -435 -439 -443 -447 -451 -455 -459 -463 Columns 121 through 150 -467 -471 -475 -479 -483 -487 -491 -495 -499 -503 -507 -511 -515 -519 -523 -527 -531 -535 -539 -543 -547 -551 -555 -559 -563 -567 -571 -575 -579 -583 Columns 151 through 180 -587 -591 -595 -599 -603 -607 -611 -615 -619 -623 -627 -631 -635 -639 -643 -647 -651 -655 -659 -663 -667 -671 -675 -679 -683 -687 -691 -695 -699 -703 Columns 181 through 202 -707 -711 -715 -719 -723 -727 -731 -735 -739 -743 -747 -751 -755 -759 -763 -767 -771 -775 -779 -783 -787 -791 ans = 1×201 logical array Columns 1 through 45 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 46 through 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 91 through 135 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 136 through 180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 181 through 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Output argument "err" (and maybe others) not assigned during call to "find_error". Error in Test2 (line 8) [errorposition, truesequence] = find_error(errorsequence);