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
Solution Comments
Show comments
Loading...
Problem Recent Solvers136
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
53942 Solvers
-
Maximum running product for a string of numbers
2259 Solvers
-
Given a window, how many subsets of a vector sum positive
875 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1299 Solvers
-
Matlab Basics II - Count rows in a matrix
412 Solvers
More from this Author21
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
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.
Additional test cases have been added and the description slightly modified.