User`s guide
differentiate
4-94
4differentiate
Purpose Differentiate a fit result object
Syntax deriv1 = differentiate(fitresult,x)
[deriv1,deriv2] = differentiate(...)
Arguments
Description
deriv1 = differentiate(fitresult,x) differentiates the fit result object
fresult at the points specified by x and returns the result to deriv1. You can
generate
fresult with the fit function or the cfit function.
[deriv1,deriv2] = differentiate(...) computes the first derivative
deriv1, and the second derivative deriv2 for the specified fit result object.
Remarks For library equations with closed forms, analytic derivatives are calculated.
For all other equations, the first derivative is calculated using the central
difference quotient
where x is the predictor value at which the derivative is calculated, h is a small
number, y
x+h
is fresult evaluated at x+h, and y
x-h
is fresult evaluated at x-h.
The second derivative is calculated using the expression
fresult A fit result object.
x A column vector of values at which fresult is differentiated.
deriv1 A column vector of first derivatives.
deriv2 A column vector of second derivatives.
y’
y
xh+
y
xh–
–
2h
---------------------------------=
y’’
y
xh+
y
xh–
2y
x
–+
h
2
------------------------------------------------=