How Can I Compute a Numerical Jacobian Matrix in MATLAB?

Click For Summary
SUMMARY

This discussion focuses on computing a numerical Jacobian matrix in MATLAB without the symbolic math toolbox. The user, Luc, utilizes the gradient function to calculate the gradient of a scalar field from a 100x100 image, resulting in a 2-element gradient vector at each pixel. Luc then computes the gradient of this gradient to derive the Jacobian matrix, concatenating the results to form the final output. The approach leverages MATLAB's built-in gradient functionality effectively, despite the absence of the symbolic math toolbox.

PREREQUISITES
  • Understanding of numerical differentiation techniques
  • Familiarity with MATLAB programming environment
  • Knowledge of gradient and Hessian matrix concepts
  • Basic image processing concepts in MATLAB
NEXT STEPS
  • Explore MATLAB's gradient function for multidimensional data
  • Learn about numerical methods for computing Hessians
  • Investigate alternative libraries for symbolic computation in MATLAB
  • Study image processing techniques for gradient vector analysis
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in numerical analysis, image processing, and anyone needing to compute Jacobian matrices without symbolic tools.

pamparana
Messages
123
Reaction score
0
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
 
Physics news on Phys.org
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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 0 ·
Replies
0
Views
5K
  • · Replies 4 ·
Replies
4
Views
8K
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K