Effacer les filtres
Effacer les filtres

Condition based integration in MatLab

3 vues (au cours des 30 derniers jours)
pritha
pritha le 7 Jan 2024
Commenté : pritha le 10 Jan 2024
I have an integration : Int(rp.^2.*G(r,rp)*drp) where the integration is with respect to rp and the limit is on rp : 0->inf and G(r,rp) = 1/r for r>rp and G(r,rp)=1/rp for r<rp How to implement this integral in MatLab.
  2 commentaires
David Goodmanson
David Goodmanson le 7 Jan 2024
Hi pritha,
For large rp the integral goes like
Int G(r,p) rp^2 drp = Int (1/rp) rp^2 drp = Int rp drp
and unfortunately, since the upper limit for rp is infinity, this integral diverges.
pritha
pritha le 7 Jan 2024
Hi David,
Thank you for your reply. If i consider the upper limit as 15-20? How will it be constructed in MatLab?

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 7 Jan 2024
Déplacé(e) : Torsten le 7 Jan 2024
syms r R rp real positive
G(r,rp) = piecewise(r<rp,1/rp,r>=rp,1/r);
int(rp^2*G(r,rp),rp,0,R)
ans = 
  5 commentaires
Torsten
Torsten le 10 Jan 2024
Modifié(e) : Torsten le 10 Jan 2024
If r is fixed and R -> Inf, you see from the integration result that the second case (r<R) is the relevant one, and the result is - as already answered by @David Goodmanson - lim(R->Inf) (R^2/2-r^2/6) = Inf
syms r rp real positive
G(r,rp) = piecewise(r<rp,1/rp,r>=rp,1/r);
int(rp^2*G(r,rp),rp,0,Inf)
ans = 
pritha
pritha le 10 Jan 2024
Thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Formula Manipulation and Simplification dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by