Cody

Solution 1877335

Submitted on 17 Jul 2019 by Evan
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
x = [1 2 -3 -4 5 6 -7 8 -9 10 11]; n = 6; assert(isequal(Zero_Cross(x),n))

ans = 6

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

ans = 1

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

ans = 0

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

ans = 2

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

x = 1 ans = 0

6   Pass
x = ones(1,50) - 25; n = 0; assert(isequal(Zero_Cross(x),n))

ans = 0

7   Pass
x = 1:50 - 25; n = 0; assert(isequal(Zero_Cross(x),n))

ans = 0

8   Pass
x = [ones(1,50); -ones(1,50)]; x = reshape(x,[1,100]); n = 99; assert(isequal(Zero_Cross(x),n))

ans = 99

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

ans = 3