Problem 42922. Zero Cross
Write a function that counts the number of times n a signal x changes sign.
Examples
x = [1 2 -3 -4 5 6 -7 8 -9 10 11] n = 6
x = [1 2 -3] n = 1
Solution Stats
Problem Comments
-
2 Comments
Jan Orwat
on 27 Aug 2016
It would be beneficial for the problem if zeros were added to test cases, for example [...,1,2,0,-1,-2,...], [...,1,2,3,0,2,3,...], [...1,2,3,0,0,0,1,2,...], [...,1,2,0,0,-1,-2,...], etc.
goc3
on 23 May 2018
Additional test cases have been added and the description slightly modified.
Solution Comments
Show commentsGroup

Indexing V
- 14 Problems
- 31 Finishers
- Find the sum of the elements in the "second" diagonal
- Find the sum of the elements in the "second" diagonal
- Find last non-zero in a given dimension
- Sorting integers by their digits (Level 1)
- Sorting integers by their digits (Level 2)
- Sorting integers by their digits (Level 3)
- Sorting integers by their digits (Level 4)
- generate number in particular way
- Assignment Problem
- Look Up Mapping
- Find longest run
- Zero Cross
- S-T-R-E-T-C-H I-T O-U-T
- Check if a rotated array was originally sorted
- Weave two matrices together to form one matrix
Problem Recent Solvers124
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!