Cody

Solution 2167472

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 = 8 14 20 26 26 32 38 44 50 56 62 ans = 1×10 logical array 0 1 1 1 1 1 1 1 1 1

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 15 10 2 -6 -14 -14 -22 -30 -38 -46 -54 -62 -70 -78 -86 -94 Columns 16 through 30 -102 -110 -118 -126 -134 -142 -150 -158 -166 -174 -182 -190 -198 -206 -214 Columns 31 through 45 -222 -230 -238 -246 -254 -262 -270 -278 -286 -294 -302 -310 -318 -326 -334 Columns 46 through 60 -342 -350 -358 -366 -374 -382 -390 -398 -406 -414 -422 -430 -438 -446 -454 Columns 61 through 75 -462 -470 -478 -486 -494 -502 -510 -518 -526 -534 -542 -550 -558 -566 -574 Columns 76 through 90 -582 -590 -598 -606 -614 -622 -630 -638 -646 -654 -662 -670 -678 -686 -694 Columns 91 through 105 -702 -710 -718 -726 -734 -742 -750 -758 -766 -774 -782 -790 -798 -806 -814 Columns 106 through 120 -822 -830 -838 -846 -854 -862 -870 -878 -886 -894 -902 -910 -918 -926 -934 Columns 121 through 135 -942 -950 -958 -966 -974 -982 -990 -998 -1006 -1014 -1022 -1030 -1038 -1046 -1054 Columns 136 through 150 -1062 -1070 -1078 -1086 -1094 -1102 -1110 -1118 -1126 -1134 -1142 -1150 -1158 -1166 -1174 Columns 151 through 165 -1182 -1190 -1198 -1206 -1214 -1222 -1230 -1238 -1246 -1254 -1262 -1270 -1278 -1286 -1294 Columns 166 through 180 -1302 -1310 -1318 -1326 -1334 -1342 -1350 -1358 -1366 -1374 -1382 -1390 -1398 -1406 -1414 Columns 181 through 195 -1422 -1430 -1438 -1446 -1454 -1462 -1470 -1478 -1486 -1494 -1502 -1510 -1518 -1526 -1534 Columns 196 through 202 -1542 -1550 -1558 -1566 -1574 -1582 -1590 ans = 1×201 logical array Columns 1 through 45 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 46 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 135 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 136 through 180 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 181 through 201 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

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