Showing processes as an Equation
Your algorithm, as described, is not correct.  You are simply counting the number of negative numbers, not the number of zero crossings.  For the particular data set that you use, B1, the two numbers are the same, but in general they won't be.

The way to do it is to multiply each number by the number after it, and if that number is negative, then you have a zero crossing.

zeroCrossings = sum((data(1:end-1) .* data(2:end)) &lt; 0);


You also need to add some logic to handle samples that are exactly zero, but hopefully you get the idea at this point.