Cody

Solution 1849829

Submitted on 15 Jun 2019
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
filetext = fileread('polyMult.m'); assert(~contains(filetext,'regexp'))

2   Fail
c1 = randi(1000); c2 = randi(1000); assert(isequal(c1*c2,polyMult(c1,c2)))

Output argument "c" (and maybe others) not assigned during call to "polyMult". Error in Test2 (line 2) assert(isequal(c1*c2,polyMult(c1,c2)))

3   Fail
c1 = [0 -1; 0 0; 1 0]; c2 = [1; -2]; c = [0 -1; 0 2; 1 0; -2 0]; assert(isequal(c,polyMult(c1,c2)))

Output argument "c" (and maybe others) not assigned during call to "polyMult". Error in Test3 (line 4) assert(isequal(c,polyMult(c1,c2)))

4   Fail
c1 = [0 -1; 0 0; 1 0]; c2 = reshape([1; -2],[1 1 2]); c = reshape([0 0 1 -1 0 0 0 0 -2 2 0 0],[3 2 2]); assert(isequal(c,polyMult(c1,c2)))

Error using * Arguments must be 2-D, or at least one argument must be scalar. Use TIMES (.*) for elementwise multiplication. Error in polyMult (line 2) y = c1*c2; Error in Test4 (line 4) assert(isequal(c,polyMult(c1,c2)))

5   Fail
c1 = reshape([0 0 0 1 -1 0 0 0],[4 1 2]); c2 = [0 -1; 0 0; 1 0]; c3 = zeros([3 3 3]); c3([9 21 25]) = [1 1 1]; c3(27) = -1; c4 = reshape([1; -2],[1 1 2]); c = zeros(8,4,5); c([56 91 104 118 126 139 149 153]) = -2*ones(1,8); c([30 53 78 88 92 101 115 123]) = -1*ones(1,8); c([24 59 72 86 94 107 117 121]) = 1*ones(1,8); c([62 85 110 120 124 133 147 155]) = 2*ones(1,8); assert(isequal(c,polyMult(c1,polyMult(c2,polyMult(c3,c4)))))

Error using * Arguments must be 2-D, or at least one argument must be scalar. Use TIMES (.*) for elementwise multiplication. Error in polyMult (line 2) y = c1*c2; Error in Test5 (line 12) assert(isequal(c,polyMult(c1,polyMult(c2,polyMult(c3,c4)))))

6   Fail
c1 = randi(1000,[2 3 4]); c2 = randi(1000,[4 5 1]); assert(isequal(polyMult(c1,c2),polyMult(c2,c1)))

Error using * Arguments must be 2-D, or at least one argument must be scalar. Use TIMES (.*) for elementwise multiplication. Error in polyMult (line 2) y = c1*c2; Error in Test6 (line 3) assert(isequal(polyMult(c1,c2),polyMult(c2,c1)))