Documentation

fnmin

Minimum of function in given interval

Syntax

fnmin(f)
fnmin(f,interv)
[minval,minsite] = fnmin(f,...)

Description

fnmin(f)returns the minimum value of thescalar-valued univariatespline infon its basic interval.

fnmin(f,interv)returns the minimum value on the interval [a..b] specified byinterv.

[minval,minsite] = fnmin(f,...)also returns a location,minsite, at which the function inftakes that minimum value,minval.

Examples

Example 1.We construct and plot a splinefwith many local extrema, then compute itsmaximumas the negative of theminimum of –f. We indicate this maximum value by adding a horizontal line to the plot at the height of the computed maximum.

rng(21); f = spmak(1:21,rand(1,15)-.5); fnplt(f) maxval = -fnmin(fncmb(f,-1)); hold on, plot(fnbrk(f,'interv'),maxval([1 1])), hold off

Example 2.Sincespmak(1:5,-1)provides the negative of the cubic B-spline with knot sequence1:5, we expect the command

[y,x] = fnmin(spmak(1:5,-1))

to return-2/3foryand3forx.

Algorithm

fnminfirst changes thebasic interval of the function to the given interval, if any. On the interval,fnminthen finds all local extrema of the function as left and right limits at a jump and as zeros of the function's first derivative. It then evaluates the function at these extrema and at the endpoints of the interval, and determines the minimum over all these values.

Was this topic helpful?