Minimum of function in given interval
the minimum value of the scalar-valued univariate spline in
f on its basic interval.
Compute the Maximum and Minimum Values of a Spline
This example shows how to calculate the maximum and minimum values of a spline in
f using the
Calculate the Maximum Value
Construct and plot a spline
f with 21 knots and 15 random coefficients.
f = spmak(1:21,rand(1,15)-.5); fnplt(f)
Compute the maximum value of
f as the negative of the minimum of
-f, then plot it as a horizontal line at the height of the computed maximum.
maxval = -fnmin(fncmb(f,-1)); hold on, plot(fnbrk(f,'interv'),maxval([1 1])), hold off
Calculate the Minimum Value
Construct and plot a spline using the
f2 = spmak(1:5,-1); fnplt(f2)
Compute the minimum value of
f2 and the site at which the spline takes on this minimum value.
[y,x] = fnmin(spmak(1:5,-1))
y = -0.6667
x = 3
f — Spline structure
Structure of a spline with the fields:
form — Polynomial spline representation
Form of the spline, returned as char.
knots — Knot sequence
Non-decreasing sequence of the knots of the spline, returned as a vector.
coefs — Coefficients of spline
scalar | vector | matrix
Coefficients of the spline, returned as a scalar, vector, matrix.
number — Spline number
Number of pieces of the spline, returned as a scalar.
order — Spline order
Order of the spline, returned as a scalar.
dim — Dimension of coefficients
Dimension of the coefficients of the spline, returned as a scalar.
interv — Searching interval
Range of values where the function computes the minimum value of
f, specified as a vector.
minval — Minimum value of spline
Minimum value of the scalar-valued univariate spline in
f, returned as a scalar.
minsite — Site of minimum value
Site at which the spline in
f takes on the minimum
minval, returned as a scalar.
fnmin algorithm first changes the basic interval of the function to the given interval, if any. On the
fnmin then 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.