Code covered by the BSD License  

Highlights from
Complex step Jacobian

5.0

5.0 | 3 ratings Rate this file 12 Downloads (last 30 days) File Size: 1.43 KB File ID: #18176

Complex step Jacobian

by Yi Cao

 

02 Jan 2008 (Updated 02 Jan 2008)

Calculate Jacobian using complex step differentiation

| Watch this File

File Information
Description

Complex step differentiation (CSD) has many advantages in efferency and accuracy over finite difference approaches (central, forward and backward). This code demonstrates how the Jacobian matrix of a given function at the reference point can be calculated using the CSD approach.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
05 Apr 2009 V. Poor  
06 Apr 2009 Angshul Majumdar

the step size 'eps' is not specified? Do U suggest a value?

06 Apr 2009 Yi Cao

Angshul,

eps is the minimal distinguishable vnumer for a particular precision system. For double precision, eps = 2^(-52) and for single precision, eps = 2^(-23). Use "help eps" to find more details.

The complex step differentiation approach can use the minimum step size to get the maximum accuracy. Hence eps is the best step the algorithm can use.

HTH.

Yi

06 May 2010 Martin Drozdik

Dear mr. Cao,

Your program is working perfectly. However there are two things I am curious about>
1. Why does the step size depend on the number of independent variables?
2. If we are computing a derivative of a function of one independent variable, and the derivative is for example 0.2, we are faced with the division (0.2eps)/eps. Why does Matlab not evaluate 0.2eps as 0 therefore leading to the incorrect derivative 0?

Thank You in forward

Please login to add a comment or rating.
Updates
02 Jan 2008

Update the example

02 Jan 2008

Update description

Tag Activity for this File
Tag Applied By Date/Time
jacobian Yi Cao 22 Oct 2008 09:41:20
complex step differentiation Yi Cao 22 Oct 2008 09:41:20
mathematics Yi Cao 22 Oct 2008 09:41:20
general Yi Cao 22 Oct 2008 09:41:20
complex step differentiation Pavel 10 Aug 2010 10:01:01
complex step differentiation Ildar 08 Feb 2012 17:17:05

Contact us at files@mathworks.com