Cody

Solution 948750

Submitted on 1 Sep 2016 by Zikobrelli
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = [1 2 -3 -4 5 6 -7 8 -9 10 11]; n = 6; assert(isequal(Zero_Cross(x),n))

g = 1 1 -1 -1 1 1 -1 1 -1 1 1 k = [] k = 2 k = 2 0 k = 2 0 -2 k = 2 0 -2 0 k = 2 0 -2 0 2 k = 2 0 -2 0 2 0 k = 2 0 -2 0 2 0 0 k = 2 0 -2 0 2 0 0 0 k = 2 0 -2 0 2 0 0 0 0 k = 2 0 -2 0 2 0 0 0 0 2 n = 6

2   Pass
x = [1 2 -3 ]; n = 1; assert(isequal(Zero_Cross(x),n))

g = 1 1 -1 k = [] k = 2 k = 2 0 n = 1

3   Pass
x = ones(1,100); n = 0; assert(isequal(Zero_Cross(x),n))

g = Columns 1 through 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 17 through 32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 33 through 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 49 through 64 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 65 through 80 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 81 through 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 97 through 100 1 1 1 1 k = [] k = 2 k = 2 2 k = 2 2 2 k = 2 2 2 2 k = 2 2 2 2 2 k = 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Column 17 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 18 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 19 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 20 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 21 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 22 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 23 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 24 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 25 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 26 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 27 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 28 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 29 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 30 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 31 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Column 33 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 34 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 35 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 36 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 37 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 38 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 39 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 40 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 41 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 42 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 43 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 44 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 45 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 46 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 17 through 32 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 33 through 47 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 k = Columns 1 through 16 2 2 2 2 2 2 2 2 2 ...

4   Pass
x=[-6.1 -4.2 -1.1 -6 7 -6 -6 -7 -6 -1]; n = 2; assert(isequal(Zero_Cross(x),n))

g = -1 -1 -1 -1 1 -1 -1 -1 -1 -1 k = [] k = -2 k = -2 -2 k = -2 -2 -2 k = -2 -2 -2 0 k = -2 -2 -2 0 0 k = -2 -2 -2 0 0 -2 k = -2 -2 -2 0 0 -2 -2 k = -2 -2 -2 0 0 -2 -2 -2 k = -2 -2 -2 0 0 -2 -2 -2 -2 n = 2

5   Pass
x=1 n = 0; assert(isequal(Zero_Cross(x),n))

x = 1 g = 1 k = [] n = 0

Suggested Problems

More from this Author21