Problem with code - symbolic integration takes awfully long time

14 vues (au cours des 30 derniers jours)
Ste_M
Ste_M le 28 Jan 2022
Commenté : Ste_M le 29 Jan 2022
Hi all, I am facing a problem concerning symbolic integration.
I have a function that I need to double integrate for variables x1 and y1. This is what my function looks like:
fun_o = p_outer*mi*(1-exp(-jo/K))*sin_delta1;
ymin = -L/2+cy-so;
ymax = L/2+cy-so
;
unknown (symbolic) parameters are x1, y1 and so and:
p_outer - is a function of y1 and so
jo - is a function of x1, y1 and so
sin_delta1 - is a function of y1
so in not dependent on neither x1 nor y1. Other parameters are numerical values.
This is what my integral looks like:
Fy_outer = int(int(fun_o, x1, -b/2, b/2), y1, ymin, ymax);
After I run the code, it takes awfully long time to compute this integral. Plus I need three more integrals which are as complex as this or even more complex than this integral. Plus I would need to run the code multiple times with different numerical values.
Profiler shows that certain mupadex function consumes the time (the 400s is the most I have let it run):
Is there any way to speed up the simulation, what am I doing wrong?
  5 commentaires
Walter Roberson
Walter Roberson le 29 Jan 2022
On my system, the release took about 216 seconds, and did not change the value. There is a chance that if OmegaR and W_outer were defined with numeric values that it could get further.
... though when I look at the denominator, it seems unlikely to me that you would be able to get anywhere symbolically even if numeric values for those were known.
It might also be worth experimenting with reversing the order of integration.
It looks to me as if your best chance at a symbolic solution would be if so were defined numerically as well as OmegaR
Ste_M
Ste_M le 29 Jan 2022
OmegaR is defined numerically as V/R which is 1/15. Defining so is the ultimate solution of the problem. I am trying to formulate a code to evaluate contact forces between two bodies. The three variables unknown being so, Omega_outer and Omega_inner which can be obtained from the equilibrium equations of motion. Problem is that I need Fy_outer and three more similar formulations (Fy_inner and two moments which are basically double integrals of Fy_outer*x1 and Fy_inner*x2) in order to set up system of three equations. All of these formulations depend on so, so I need to express them in the form f=f(so), put them in the system of equations, define so and then evaluate forces when so is known for the given set of inputs.

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by