iderivative
Derivative of a univariate, vectorvalued function using the complexstep approximation.
Back to Numerical Differentiation Toolbox Contents.
Contents
Syntax
df = iderivative(f,x0) df = iderivative(f,x0,h)
Description
df = iderivative(f,x0) numerically evaluates the derivative of with respect to at using the complexstep approximation with a default step size of .
df = iderivative(f,x0,h) numerically evaluates the derivative of with respect to at using the complexstep approximation with a userspecified step size .
Input/Output Parameters
Variable  Symbol  Description  Format  
Input  f  univariate, vectorvalued function ()  1×1 function_handle 

x0  evaluation point  1×1 double 

h  (OPTIONAL) step size  1×1 double 

Output  df  derivative of with respect to , evaluated at  m×1 double 
Note
 This function requires 1 evaluation of .
 If the function is scalarvalued, then .
Example #1: Derivative of a scalarvalued function.
Approximate the derivative of at using the iderivative function, and compare the result to the true result of .
Approximating the derivative,
f = @(x) x^3; df = iderivative(f,2)
df = 12
Calculating the error,
error = df12
error = 0
Example #2: Derivative of a vectorvalued function.
Approximate the derivative of
at using the iderivative function, and compare the result to the true result of
Approximating the derivative,
f = @(t) [sin(t);cos(t)]; df = iderivative(f,1)
df = 0.5403 0.8415
Calculating the error,
error = df[cos(1);sin(1)]
error = 0 0