Clear Filters
Clear Filters

Jacobian matrix in ode15s

27 views (last 30 days)
Tony Cheng
Tony Cheng about 13 hours ago
Edited: Torsten about 4 hours ago
Hi everyone,
I am using ode15s to solve a set of stiff odes and the final model is developed in the form of
where M(t,y) is the mass matrix, and y is the generalised coordinate vector. According to the syntax of ode15s, it is crucial to provide its Jacobian matrix to raise the accuracy.
I do not know too much numerical calculation of stiff odes, and here I want to know, is the Jacobian matrix JJ calculated in this manner:
If not, how to arrive at a correct one?
Many thanks!
  3 Comments
Tony Cheng
Tony Cheng 2 minutes ago
Hi Torsten,
The odes are from a mechanical system describing its dynamic behaviour. If so, I think I will not try to format the codes about the Jacobian matrix, since the model is very complex with a large number of generalised coordinates and the mass matrix, the Coriolis/centrifugal force matrix, and the generalised force vector are very dense with lengthy elements inside them.
BTW, are there any ways to format a good odeset to raise the computational efficiency and accuracy? Many THX!
Cheers
Cheng
Torsten
Torsten 4 minutes ago
Edited: Torsten 1 minute ago
BTW, are there any ways to format a good odeset to raise the computational efficiency and accuracy?
RelTol and AbsTol are the usual parameters that influence accuracy. I doubt there will be a great gain in efficiency by supplying the Jacobian matrix - especially since most probably you had to use finite differencing like ode15s itself because of the complexity of your model.
I'd start with the standard settings for odeset - often, beginners have good intentions, but tend to make things worse.

Sign in to comment.

Answers (1)

Dheeraj
Dheeraj about 6 hours ago
Hi Tony chegg,
I understand you want to know how to calculate jacobian matrix in order to increase the accuracy of your model.
When solving stiff differential equations with "ODE15s", you are typically dealing with equations of the form:
where is the mass matrix, and represents the nonlinear term.
To use "ODE15s" effectively, you need to provide the Jacobian matrix of the function with respect to y, which is used to handle the stiffness in the system. This Jacobian matrix is denoted as "J" and is defined as:
You can easily calculate Jacobian matrix if you have an explicit expression for, you can compute the Jacobian matrix analytically. This involves differentiating with respect to each component of y.
Or You could use "jacobian" fucntion part of Symbolic Math Toolbox to do the same.
You could refer to the below MATLAB's documentation to know more about "jacobian" fucntion and it's usage:
Thank You.
  1 Comment
Tony Cheng
Tony Cheng 2 minutes ago
Hi Dheeraj,
Many thanks for your immediate response! I think it is all right for this question.
However, I have another question, i.e., if the dynamic model is written as
Then is its Jacobian matrix calculated in this following manner:
Many thanks!
BTW, I am not familiar with the numerical solutions of non-stiff or stiff ODEs, especially their Jacobian matrices (But I know well what the Jacobian matrix means). Could you pls recommend some textbooks or papers in this tiny realm?
Cheers
Cheng

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!