Cody

# Problem 44268. Combination of Vectors

Solution 1264457

Submitted on 7 Sep 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
y11 = [4 3 0 3]; y21 = [2 0 1 3]; x11 = [0 1 1 2]; x21 = [-2 4 1 2]; a1 = [-2 4 0 2]; assert(isequal(piecewise(x11, y11, x21, y21),a1))

Undefined function or variable 'y11'. Error in piecewise (line 2) ind1 = (y11>y21); Error in Test1 (line 6) assert(isequal(piecewise(x11, y11, x21, y21),a1))

2   Fail
y12 = [2 2 2 2]; y22 = [0 4 0 4]; x12 = [1 1 1 1]; x22 = [1 1 1 1]; a2 = [1 0 1 0]; assert(isequal(piecewise(x12, y12, x22, y22),a2))

Undefined function or variable 'y11'. Error in piecewise (line 2) ind1 = (y11>y21); Error in Test2 (line 6) assert(isequal(piecewise(x12, y12, x22, y22),a2))

3   Fail
y23 = [2 2 2 2]; y13 = [0 4 0 4]; x13 = [2 2 2 2]; x23 = [2 2 2 2]; a3 = [0 2 0 2]; assert(isequal(piecewise(x13, y13, x23, y23),a3))

Undefined function or variable 'y11'. Error in piecewise (line 2) ind1 = (y11>y21); Error in Test3 (line 6) assert(isequal(piecewise(x13, y13, x23, y23),a3))

4   Fail
y14 = zeros(1, 100); y24 = ones(1, 100); x14 = ones(1,100); x24 = 2*ones(1,100); a4 = zeros(1, 100); assert(isequal(piecewise(x14, y14, x24, y24),a4))

Undefined function or variable 'y11'. Error in piecewise (line 2) ind1 = (y11>y21); Error in Test4 (line 6) assert(isequal(piecewise(x14, y14, x24, y24),a4))

5   Fail
y25 = 2; y15 = 0; x15 = 2; x25 = 2; a5 = 0; assert(isequal(piecewise(x15, y15, x25, y25),a5))

Undefined function or variable 'y11'. Error in piecewise (line 2) ind1 = (y11>y21); Error in Test5 (line 6) assert(isequal(piecewise(x15, y15, x25, y25),a5))