Cody

Solution 1166337

Submitted on 19 Apr 2017
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
x = 20; n = 3; y_correct = 3; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint1 (line 4) assert(isequal(nextpow(n,x),y_correct));

2   Fail
x = 16; n = 4; y_correct = 2; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint2 (line 4) assert(isequal(nextpow(n,x),y_correct));

3   Fail
x = 81; n = 8; y_correct = 3; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint3 (line 4) assert(isequal(nextpow(n,x),y_correct));

4   Fail
x = 0; n = 1; y_correct = 0; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint4 (line 4) assert(isequal(nextpow(n,x),y_correct));

5   Fail
x = -32; n = 2; y_correct = 5; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint5 (line 4) assert(isequal(nextpow(n,x),y_correct));

6   Fail
x = -100; n = 10; y_correct = 2; assert(isequal(nextpow(n,x),y_correct));

Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. Error in nextpow (line 2) find(n^(0:6)>=x,1)-1 Error in TestPoint6 (line 4) assert(isequal(nextpow(n,x),y_correct));