How can I compute the Jacobian of a vector-valued function dependent on more than one variable using MATLAB 7.10 (R2010a)?

I want to compute the Jacobian of a vector-valued function dependent on more than one variable at a specified point.

 Accepted Answer

If you have access to the Optimization Toolbox, you can use the LSQNONLIN function to numerically compute the Jacobian of a vector-valued function at a specified point. To do this, execute LSQNONLIN with the specified point as the starting point, set the ‘MaxIter’ option to zero, and extract the ‘jacobian’ output argument. For example:
k = 1:10;
F = @(x) 2 + 2*k-exp(k*x(1))-exp(k*x(2)); % Vector valued function dependent on two variables
x0 = [0.3 0.4] % Point at which Jacobian needs to be estimated
[x,~,~,~,~,~,jacobian] = lsqnonlin(F,x0,[],[],optimset('MaxIter',0))
Please not that the Jacobian is computed numerically and contains inaccuracies. In other words, it is not an analytical Jacobian. The exact algorithm used to compute the Jacobian, is dependent on the ‘Algorithm’ setting with which LSQNONLIN is called. For details about the algorithm used in computing the Jacobian, please see references listed on the following documentation page:

More Answers (0)

Categories

Products

Release

R2010a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!