Spline Toolbox    
fnzeros

Find zeros of a function in a given interval

Syntax

Description

z = fnzeros(f) provides the 2-rowed matrix z that is an ordered list of the zeros of the univariate spline in f in its basic interval.

z = fnzeros(f,[a b]) looks for zeros only in the interval [a .. b] specified by the input.

Each column z(:,j) contains the left and right endpoint of an interval. These intervals are of three kinds:

Examples

Example 1. We construct and plot a piecewise linear spline that has each of the three kinds of zeros, use fnzeros to compute all its zeros, and then mark the results on that graph.

This gives the following list of zeros:

In this simple example, even for the second kind of zero, the two endpoints agree to all places.

Example 2. We generate a spline function with many extrema and locate all that are in a certain interval by computing the zeros of the spline function's first derivative there.

Example 3. We construct a spline with a zero at a jump discontinuity and in B-form and find all the spline's zeros in an interval that goes beyond its basic interval.

This gives the following list of zeros:

Notice the resulting zero interval [2..2.7], due to the fact that, by definition, a spline in B-form is identically zero outside its basic interval.

Algorithm

fnzeros first converts the function to B-form. It locates zero intervals by the corresponding sequence of consecutive zero B-spline coefficients. It locates the sign changes in the B-spline coefficients for the function, isolates them from each other by suitable knot insertion, and then uses the Modified Regula falsi to locate the corresponding sign changes in the function, if any.

See Also

fnmin, fnval


  fnval getcurve