fnplt
Plot function
Syntax
fnplt(f)
fnplt(f,arg1,arg2,arg3,arg4)
points = fnplt(f,...)
[points, t] = fnplt(f,...)
Description
fnplt(f)
plots the function, described byf
, on its basic interval.
Iffis univariate, the following is plotted:
Iffis scalar-valued, the graph offis plotted.
Iffisd-vector-valued withd> 2, b给出的空间曲线y the first three components offis plotted.
Iffis bivariate, the following is plotted:
Iffis scalar-valued, the graph offis plotted (via
surf
).Iffis 2-vector-valued, the image in the plane of a regular grid in its domain is plotted.
Iffisd-vector-valued withd> 2, then the parametric surface given by the first three components of its values is plotted (via
surf
).
Iffis a function of more than two variables, then the bivariate function, obtained by choosing the midpoint of the basic interval in each of the variables other than the first two, is plotted.
fnplt(f,arg1,arg2,arg3,arg4)
permits you to modify the plotting by the specification of additional input arguments. You can place these arguments in whatever order you like, chosen from the following list:
Acharacter vectorthat specifies a plotting symbol, such as
'-.'
or'*'
; the default is“- - -”
.Ascalarto specify the linewidth; the default value is
1
.Acharacter vectorthat starts with the letter
'j'
to indicate that any jump in theunivariatefunction being plotted should actually appear as a jump. The default is to fill in any jump by a (near-)vertical line.Avectorof the form
[a,b]
, to indicate the interval over which to plot theunivariate
function inf
. If the function inf
ism-variate, then this optional argument must be a cell array whose ith entry specifies the interval over which theith argument is to vary. In effect, for thisarg
, the commandfnplt(f,arg,...)
has the same effect as the commandfnplt(fnbrk(f,arg),...)
. The default is the basic interval off
.An empty matrix or character vector, to indicate use of default(s). You will find this option handy when your particular choice depends on some other variables.
points = fnplt(f,...)
plots nothing, but the two-dimensional points or three-dimensional points it would have plotted are returned instead.
[points, t] = fnplt(f,...)
also returns, for a vector-valuedf
, the corresponding vectort
of parameter values.
Cautionary Note
The basic interval forfin B-form is the interval containingalltheknots. This means that, e.g.,fis sure to vanish at the endpoints of the basic interval unless the first and the last knot are both of full multiplicityk, withkthe order of the splinef. Failure to have such fullmultiplicity is particularly annoying whenfis a spline curve, since the plot of that curve as produced byfnplt
is then bound to start and finish at the origin, regardless of what the curve might otherwise do.
Further, since B-splines are zero outside their support, any function in B-form is zero outside thebasic interval of its form. This is very much in contrast to a function in ppform whose values outside the basic interval of the form are given by the extension of its leftmost, respectively rightmost, polynomial piece.
Algorithms
A vectorx
of evaluation points is generated by the union of:
101 equally spaced sites filling out the plotting interval
Any breakpoints in the plotting interval
The univariate functionfdescribed byf
is evaluated at thesex
evaluation points. Iffis real-valued, the points (x,f(x)) are plotted. Iffis vector-valued, then the first two or three components off(x) are plotted.
The bivariate functionfdescribed byf
is evaluated on a 51-by-51 uniform grid iffis scalar-valued ord-vector-valued withd> 2 and the result plotted bysurf
. In the contrary case,fis evaluated along the meshlines of a 11-by-11 grid, and the resulting planar curves are plotted.