Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

numerical jacobian matrix in matlab

868 views
Skip to first unread message

anja...@googlemail.com

unread,
Nov 5, 2010, 8:35:20 PM11/5/10
to
Hello,

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 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,

Anja

anja...@googlemail.com

unread,
Nov 5, 2010, 9:02:32 PM11/5/10
to
So, I did the following, which I hope is correct:

[FX, FY] = gradient(fun); % Gradient of the scalar field
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,

Anja

Eric Diaz

unread,
Nov 6, 2010, 2:09:03 AM11/6/10
to
I'm not sure if this is what your interested in, but you could try the following snippet of code that I wrote for one of my programs

% Optimized rotation invariant Hessian 3x3
% Reference: D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives

Hx = [ 17 61 17 ;
0 0 0 ;
-17 -61 -17 ];

% Calculate image Derivatives
Lx = conv2(img, Hx, 'same');
Ly = conv2(img, Hx', 'same');

Lx and Ly, should be images that contain the derivative values at each pixel position

Torsten

unread,
Nov 6, 2010, 7:32:16 AM11/6/10
to
On 6 Nov., 02:02, "anja.e...@googlemail.com"

According to
http://www.mathworks.de/help/techdoc/ref/gradient.html
fun must be a two-dimensional matrix in order to calculate FX and FY.
So evaluate your scalar function on a rectangle with spacings dx and
dy.
Then two subsequent calls to the gradient function
(first with the matrix F and then with the two matrices FX and FY)
will give you the Hessian.
Don't forget to include the spacings dx and dy !

Best wishes
Torsten.

anja...@googlemail.com

unread,
Nov 6, 2010, 3:13:25 PM11/6/10
to
On Nov 6, 11:32 am, Torsten <Torsten.Hen...@umsicht.fraunhofer.de>
wrote:

> On 6 Nov., 02:02, "anja.e...@googlemail.com"
>
> <anja.e...@googlemail.com> wrote:
> > So, I did the following, which I hope is correct:
>
> > [FX, FY] = gradient(fun); % Gradient of the scalar field
> > 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,
>
> > Anja
>
> According tohttp://www.mathworks.de/help/techdoc/ref/gradient.html

> fun must be a two-dimensional matrix in order to calculate FX and FY.
> So evaluate your scalar function on a rectangle with spacings dx and
> dy.
> Then two subsequent calls to the gradient function
> (first with the matrix F and then with the two matrices FX and FY)
> will give you the Hessian.
> Don't forget to include the spacings dx and dy !

This is sort of what I am doing. fun is an image, so a 2D matrix with
scalar values at each point and the gradient call does the job and
then I am calling gradient again after concatenating FX and FY.

Thanks,
Anja

iamusam...@gmail.com

unread,
May 28, 2019, 2:58:59 PM5/28/19
to
hey there does any one knows how to make a jocobian of 2R serial manipulator.?
0 new messages