Cody

# Problem 42922. Zero Cross

Solution 1460272

Submitted on 10 Mar 2018 by J. S. Kowontan
• Size: 14
• 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
x = [1 2 -3 -4 5 6 -7 8 -9 10 11]; n = 6; assert(isequal(Zero_Cross(x),n))

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

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

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

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

x = 1

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

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

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

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

### Community Treasure Hunt

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

Start Hunting!