Jacobians using Simscape (numerical or symbolic)

I'm working with a Simscape model and I'm trying to get a numerical or possibly analytical form Jacobian for my system (given specific frames).
Actually I'm using multibody, but problem could be of general interest. Better if using geometrical approach. I know that some toolbox already perform same operation and give it using geometrical approch.
I tought using a numerical differentiation would be an answer, but is by far too complex, heavy and clumsy to carrry out for my purpose, thus I was looking for an alternative method to be used in one single run.

4 Comments

Simulink and Simscape are more or less incompatible with the Symbolic Toolbox. (More correctly, any use of the Symbolic Toolbox must be completely local, with the output values converted back into pure numeric form.)
Hi @ENRICO,
As per my understanding, you would like to get a Jacobian matrix for a Simscape multibody system using “geometrical approach”.
MathWorks’ “Symbolic Math Toolbox” is used to compute Jacobian matrix analytically. The following examples of Symbolic Math Toolbox use Simscape and might help to analyse a physical system:
Now after analysing the physical system, the following MathWorks documentation links help in calculating the Jacobian matrix using MATLAB:
In addition, configuring the solvers may help in improving speed and accuracy of the calculations. Refer to the below documentation links for more information:
I hope this is beneficial gives you a head start!
Well, that's the matter in the end.... I know how to build up a jacobian if I've the symbolic model, but using simscape directly fropm simulink is not given free access to final model (basing on my knowledges), unless it's obvously calcualted beneath, and used for code generation. So I ths should be nice to have a symbolic representation, at least where possible of a simscape model, since is a different representation of same system, and in any case solution would be of numerical more than closed form nature. Given references are not giving me a solution to my needs
Hi @ENRICO,
Could you clearly outline the requirements and specify the exact workflow you need? This will help me assist you more effectively :)

Sign in to comment.

Answers (1)

The Jacobian of the system of equations is formulated by the solver, but I don't think it's available explicitly in any form. In Model Settings -> Solver, if you select an implicit solver (daessc, ode23t, etc.), you'll see an option for Jacobian method, where you can choose between analytical and numerical (perturbation) ways of storing the Jacobian. The Jacobian is needed for the nonlinear iteration in implicit solvers, but no it's not visible.
The solver profiler tool can tell you how many times the solver decided to recompute the Jacobian during the simulation, but still, the Jacobian itself isn't available in any form outside the simulation. At least I don't know of a way.

5 Comments

I see that at least in some case there's chance to access to jacobian. See
On the other side it's a limited options and I've not found what I was seekign really. I understand is not obvious, as well as system state on the other side, bt would be very useful. Indeed in simscape is one of prominent diagnostic elements explicitly recall in debug....Dunno, support is not helping much!
Curious: what is the reason that you're trying to get a numerical or analytical form of the Jacobian? Maybe there is another to get there?
Of course one can attempt a different way, but a straightforward one is preferable anyway, accccessing directly to internally computed, assuring alignment. Morever, I don't see reason for not having a part of calcualtion involved in the process, is just efficiency and reliability
Oh, I wasn't talking about another way to get the jacobian. I'm wondering what is the purpose of obtaining the Jacobian. Are you trying to improve the numerical performance of the model? Choose the best solver? I'm trying to see if there are other suggestions I can provide since the actual Jacobian isn't available.
Ah! Ok. There are many reasons in truth. Jacobians are much more used and useful in mechanics than in many other fields, so it's wothy have it, especially when dealing with complex systems. Essentially for a rgid body system most of quantities of interest could be derived from. Specifically in my case I want ot use it as part of building a regressor matrix numerically.

Sign in to comment.

Categories

Products

Release

R2023b

Asked:

on 18 Aug 2024

Commented:

on 24 Aug 2024

Community Treasure Hunt

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

Start Hunting!