Cody

# Problem 44268. Combination of Vectors

Solution 3392088

Submitted on 26 Oct 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
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))

Error in solution: Line: 4 Column: 13 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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))

Error in solution: Line: 4 Column: 13 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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))

Error in solution: Line: 4 Column: 13 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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))

Error in solution: Line: 4 Column: 13 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 4 Column: 13 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!