zerocrossings

The number of sign reversals in a vector.

Syntax

zerocrossings(dep_vec)

Argument

dep_vec
The vector used to calculate the number of axis crossings.

Example

Templex Expression Results
{zerocrossings({0,2,-1,2,-1,-1})} 3

A plot of this example is shown below:



Figure 1.

Each of the markers indicates where the plot has crossed the axis (zero-line).

Comments

The first point of a curve is not considered as a sign reversal if it lies on the axis. The same is true of the endpoint of a curve.