Cody

Problem 44268. Combination of Vectors

Solution 1698376

Submitted on 21 Dec 2018 by HH
  • Size: 9
  • This is the leading solution.
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
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))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In piecewise (line 2) In ScoringEngineTestPoint1 (line 6) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In piecewise (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In piecewise (line 2) In ScoringEngineTestPoint3 (line 6) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In piecewise (line 2) In ScoringEngineTestPoint4 (line 6) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In piecewise (line 2) In ScoringEngineTestPoint5 (line 6) In solutionTest (line 11)]