Differentiate cfit
or sfit
object
Note
Use these syntaxes for sfit
objects.
[
differentiates the surface fx
, fy
] = differentiate(FO
, X
, Y
)FO
at the points specified by
X
and Y
and returns the result in
fx
and fy
.
FO
is a surface fit (sfit
) object
generated by the fit
function.
X
and Y
must be double-precision arrays
and the same size and shape as each other.
All return arguments are the same size and shape as X
and
Y
.
If FO
represents the surface , then FX
contains the derivatives with
respect to x, that is, , and FY
contains the derivatives with
respect to y, that is, .
[
computes the first and second derivatives of the surface fit object
fx
, fy
, fxx
, fxy
, fyy
] = differentiate(FO
, ...)FO
.
fxx
contains the second derivatives with respect to
x
, that is, .
fxy
contains the mixed second derivatives, that is, .
fyy
contains the second derivatives with respect to
y
, that is, .
For library models with closed forms, the toolbox calculates derivatives analytically. For all other models, the toolbox calculates the first derivative using the centered difference quotient
where x is the value at which the toolbox calculates the
derivative, is a small number (on the order of the cube root of eps
), is fun
evaluated at , and is fun
evaluated at .
The toolbox calculates the second derivative using the expression
The toolbox calculates the mixed derivative for surfaces using the expression