| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Spline Toolbox |
| Contents | Index |
| Learn more about Spline Toolbox |
z = fnzeros(f)
z = fnzeros(f,[a b])
z = fnzeros(f) provides the 2-rowed matrix z that is an ordered list of the zeros of the continuous 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:
If the endpoints agree, then the function in f is relatively small at that point.
If the endpoints agree to many significant digits, then the function changes sign across the interval, and the interval contains a zero of the function — provided the function is continuous there.
If the endpoints are not close, then the function is zero on the entire interval.
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.
sp = spmak(augknt(1:7,2),[1,0,1,-1,0,0,1]); fnplt(sp) z = fnzeros(sp) nz = size(z,2); hold on plot(z(1,:),zeros(1,nz),'>',z(2,:),zeros(1,nz),'<'), hold off
This gives the following list of zeros:
z =
2.0000 3.5000 5.0000
2.0000 3.5000 6.0000
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.
rand('seed',23)
sp = spmak(1:21,rand(1,16)-.5);
fnplt(sp)
z = mean(fnzeros(fnder(sp),[7,14]));
zy = fnval(sp,z);
hold on, plot(z,zy,'o'), hold off

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.
sp = spmak([0 0 1 1 2],[1 0 -.2]); fnplt(sp) z = fnzeros(sp,[.5, 2.7]) zy = zeros(1,size(z,2)); hold on, plot(z(1,:),zy,'>',z(2,:),zy,'<'), hold off
This gives the following list of zeros:
z =
1.0000 2.0000
1.0000 2.7000
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.
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.
fnzeros may not work correctly for discontinuous functions. For example, for the discontinuous piecewise linear function provided by
sp = spmak([0 0 1 1 2 2],[-1 1 -1 1]), fnzeros(sp)
will only find the zero in (1..2), but not the zero in (0..1) nor the jump through zero at 1.
![]() | fnxtr | franke | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |