x0 =
zerocrossing (x, y)
¶Estimates the points at which a given waveform y=y(x) crosses the x-axis using linear interpolation.
See also: fzero, roots.
The following code
x = linspace(0,1,100); y = rand(1,100)-0.5; x0= zerocrossing(x,y); y0 = interp1(x,y,x0); plot(x,y,x0,y0,'x')
Produces the following figure
Figure 1 |
---|
The following code
x = linspace(0,1,100); y = rand(1,100)-0.5; y(10:20) = 0; x0= zerocrossing(x,y); y0 = interp1(x,y,x0); plot(x,y,x0,y0,'x')
Produces the following figure
Figure 1 |
---|
Package: signal