PDA

View Full Version : Matlab help needed: numerical jacobian


pamparana
Nov5-10, 07:38 PM
Hello everyone,

Does anyone know how I can compute the jacobian matrix numerically in matlab?

So, I have the following. A 100x100 image and at each pixel, I have a 2 element gradient vector. What I would like to do is compute the jacobian matrix (wrt to the spatial location), at each pixel position.

Does anyone know how I can do that? I do not have the symbolic math toolbox, so I cannot use the built-in jacobian function :(

Thanks,

Luc

pamparana
Nov5-10, 08:04 PM
So, I did the following, which I hope is correct:

[FX, FY] = gradient(fun); % Gradient of the scalar field. Jacobian of scalar field is the gradient
T = cat(3, FX, FY);
[TTX, TTY]=gradient(T); % Compute gradient of the gradient
TT=cat(3, TTX, TTY); % This should be the hessian or jacobian of the gradient

Does this seem correct?

Thanks,

Luc