Cody

# Problem 42922. Zero Cross

Solution 3473404

Submitted on 29 Oct 2020 by Payam Morsali
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))

j = 1 j = 2 j = 3 j = 4 j = 5 j = 6 n = 6

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

j = 1 n = 1

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

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

j = 1 j = 2 n = 2

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

x = 1 n = 0

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

n = 0

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

n = 0

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

j = 1 j = 2 j = 3 j = 4 j = 5 j = 6 j = 7 j = 8 j = 9 j = 10 j = 11 j = 12 j = 13 j = 14 j = 15 j = 16 j = 17 j = 18 j = 19 j = 20 j = 21 j = 22 j = 23 j = 24 j = 25 j = 26 j = 27 j = 28 j = 29 j = 30 j = 31 j = 32 j = 33 j = 34 j = 35 j = 36 j = 37 j = 38 j = 39 j = 40 j = 41 j = 42 j = 43 j = 44 j = 45 j = 46 j = 47 j = 48 j = 49 j = 50 j = 51 j = 52 j = 53 j = 54 j = 55 j = 56 j = 57 j = 58 j = 59 j = 60 j = 61 j = 62 j = 63 j = 64 j = 65 j = 66 j = 67 j = 68 j = 69 j = 70 j = 71 j = 72 j = 73 j = 74 j = 75 j = 76 j = 77 j = 78 j = 79 j = 80 j = 81 j = 82 j = 83 j = 84 j = 85 j = 86 j = 87 j = 88 j = 89 j = 90 j = 91 j = 92 j = 93 j = 94 j = 95 j = 96 j = 97 j = 98 j = 99 n = 99

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

j = 1 j = 2 j = 3 n = 3

### Community Treasure Hunt

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

Start Hunting!