Created
April 21, 2018 12:58
Star
You must be signed in to star a gist
Complex step approximation to derivative.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fd = complex_step(f,x,h) | |
%COMPLEX_STEP Complex step approximation to derivative. | |
% fd = COMPLEX_STEP(f,x,h) computes the complex step approximation | |
% fd to the derivative of f at x, using step h (default 1e-100). | |
if nargin < 3, h = 1e-100; end | |
fd = imag( f(x + sqrt(-1)*h) )/h; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment