Jacobian Matrix of partial derivatives of a nonlinear system

34 views (last 30 days)
Hello to everyone, i am trying to compute dynamically the jacobians of a nonlinear system. Let say i cannot have the description of he system; It is like a black box and i can just observe the states or measure the outputs!! Is it correct(theoretically) to approximate for example the jacobian-element H(i,j) using H(i,j) = difference of output(i) / difference of output(j) ?? If not why? i have build a simulink block which apply this operation on each output and on each state to build me what i think should be an aprroximation of the system. Please, i am not yet a Control-system expert and would like to know your opinions. Thank you for your help and time. Armand

Accepted Answer

Matt Tearle
Matt Tearle on 23 Mar 2011
Yes, you can use any standard finite difference approximation to get a Jacobian, so H(i,j) = diff(output(i))/diff(input(j)) would work. Computationally it can be expensive. If your system returns the output as a vector, you can at least get the columns of H as vectors - that is, H(:,j) = diff(output)/diff(input(j)).

More Answers (3)

Armand
Armand on 23 Mar 2011
That is also what i thought. But i try to test the jacobian, by multiplying a simulink signal x(k) (dimensions [3x1], for example three sinus waves) with a matrix C([2x3]), to obtain y. Then i gave y and x as inputs to my Jacobian Block. I was expecting to receive as output a matrix [2x3], with nearly the same values as in C. The output dimensions was as expected, but the values weren't!? Could someone maybe explain why? Thanks a lot for the answer(s). Armand
  1 Comment
Matt Tearle
Matt Tearle on 23 Mar 2011
Perhaps I misunderstand, but if you're defining your function as y = C*x, then any f.d. method should return the exact Jacobian (C). I think we'd have to see the code to work out what the problem is.

Sign in to comment.


Matt Tearle
Matt Tearle on 23 Mar 2011
Here's a f.d. Jacobian function I threw together:
function J = fdjacobian(f,x,dx)
y = f(x);
m = length(y);
n = length(x);
J = zeros(m,n);
for k = 1:n
xnew = x;
xnew(k) = xnew(k)+dx;
ynew = f(xnew);
J(:,k) = ynew-y;
end
J = J/dx;
But you can find something similar, but better, on File Exchange. Check out Yi Cao's complex-step Jacobian.
  2 Comments
Haseeb Hassan
Haseeb Hassan on 15 May 2018
How i can use Jacobian Function to find derivatavies of the image in X and X Direction?
Yasaman Asiaee
Yasaman Asiaee on 19 Sep 2022
how can I give a 3 nonlinear equation to this functions as f?

Sign in to comment.


Armand Chrystel Moutchiho
Well, actually i want to approximate the jacobians of a nonlinear system for which i don't have the function f/fun. I want to use it to compute the extended kalman filter! For example i might want to predict the outputs of a vehicle, whereby the input is the Acceleration/Brake-Pedal positions and the output is the Speed. As inputs for the simple kalman filter, i approximated the matrices A, B and C by use of the recursive least square algorithm(from which i get a parametrised transfer function. Then i can get the state space model with matlab functions). But for the extended kalman filter the linear state space matrices are not sufficient anymore, and i need the jacobians of my system, while only having the inputs and beeing able to measure the ouputs/States acceleration, speed and position of the vehicle. I would have pasted a picture here of the for-iteration subsystem i used to approximate the jacobians, as i said in my first post, but i think one cannot paste a picture here. right!??

Community Treasure Hunt

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

Start Hunting!