Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB I want to compute the Jacobian of a function in Matlab

  1. Jan 30, 2012 #1

    hunt_mat

    User Avatar
    Homework Helper

    Hi,

    I have a function of the form:
    function r=d(f,j)
    if (j==1)
    r=3*f(1)+f(3)*f(2)-3;
    elseif(j==2)
    r=f(1)+2*f(2)-4;
    else
    r=f(1)*f(2)*f(3)-1;
    end

    and I would like to be able to numerically compute the Jacobian for such a function. I have a method of computing the Jacobian but I am not convinced that it is giving the right answer though.

    for i=1:3
    for j=1:3
    T=zeros(3,1);
    T(j)=dd;
    J(i,j)=(d(f+T,i)-d(f,i))/dd; %This is the jacobian
    end
    end

    Does anyone have anything better?
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Loading...
Similar Threads for compute Jacobian function Date
Maple Computing Numerical Integrals with Maple Apr 6, 2018
Mathematica Mathematica Computation Time Jul 30, 2017
Mathematica How to compute the Riemann tensor using RGTC mathematica? Apr 25, 2017
Maple Variable summation limits in Maple or similar programs Apr 22, 2017
Numerical Jacobian Oct 14, 2014