Cody

Solution 1590594

Submitted on 24 Jul 2018
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
assert(isequal(nonuniformQuantizer(-23), -3.5));

Assertion failed.

2   Fail
assert(isequal(nonuniformQuantizer(0), 0.5));

Assertion failed.

3   Fail
assert(isequal(nonuniformQuantizer(1.1), 1.5));

Assertion failed.

4   Fail
assert(isequal(nonuniformQuantizer(2.9), 1.5));

Assertion failed.

5   Fail
assert(isequal(nonuniformQuantizer(-Inf), -3.5));

Assertion failed.

6   Fail
assert(isequal(nonuniformQuantizer(Inf), 3.5));

Assertion failed.

7   Fail
x = -4.0:0.5:4.5; y = [-3.5 -3.5 -1.5 -1.5 -1.5 ... -1.5 -0.5 -0.5 0.5 0.5 1.5 ... 1.5 1.5 1.5 3.5 3.5 3.5 3.5]; assert(isequal(y, nonuniformQuantizer(x)));

Assertion failed.

8   Fail
x = -4.0:0.5:4.5; y = [-3.5 -3.5 -1.5 -1.5 -1.5 ... -1.5 -0.5 -0.5 0.5 0.5 1.5 ... 1.5 1.5 1.5 3.5 3.5 3.5 3.5]; assert(isequal(y', nonuniformQuantizer(x')));

Assertion failed.

9   Fail
x = -4.0:0.5:4.5; y = [-3.5 -3.5 -1.5 -1.5 -1.5 ... -1.5 -0.5 -0.5 0.5 0.5 1.5 ... 1.5 1.5 1.5 3.5 3.5 3.5 3.5]; assert(isequal(reshape(y,3,6), ... nonuniformQuantizer(reshape(x,3,6))));

Assertion failed.

10   Fail
x = -4.0:0.5:4.5; y = [-3.5 -3.5 -1.5 -1.5 -1.5 ... -1.5 -0.5 -0.5 0.5 0.5 1.5 ... 1.5 1.5 1.5 3.5 3.5 3.5 3.5]; assert(isequal(reshape(y,1,6,3), ... nonuniformQuantizer(reshape(x,1,6,3))));

Assertion failed.