Finding limits such that integral achieves desired value
Afficher commentaires plus anciens
Hello,
I want to find the upper limit of an integral such that the desired value is obtained. I have found a way, but I would like to reduce computation time. Could you please suggest alternate functions/methods?
syms T upper_lim;
acc_indef = -2.5*T;
T0=solve(int(acc_indef,T,0,upper_lim)+5==0,upper_lim);
This is a simple integral whose upper limit is to be calculated such that the value of the integral is -5...
Thanks in advance :)
Réponse acceptée
Plus de réponses (1)
John D'Errico
le 22 Nov 2017
Seriously?
syms T upper_lim;
acc_indef = -2.5*T;
vel = int(acc_indef,T,0,upper_lim)+5;
vel
vel =
5 - (5*upper_lim^2)/4
You are worried about the solve time? Are you needing to solve this that often? The solution is trivial.
upper_lim = +2 or -2
Do it once. WTP?
2 commentaires
RPatel
le 22 Nov 2017
John D'Errico
le 23 Nov 2017
Of course I could have suggestions. But the fact is, you did not tell us the actual problem you had, or even imply that this was only a simple example. I could suggest lots of things that were wild overkill for a trivial problem. But why bother?
So, depending on the real problem, you MIGHT use fzero. You might do some of the algebra in advance, you might use some other solver. You MIGHT do lots of things.
Compute as much as you can once, up front. Use the most efficient tools. If you don't need symbolic precision, then why would you use symbolic tools?
Catégories
En savoir plus sur Calculus dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!