필터 지우기
필터 지우기

Condition based integration in MatLab

조회 수: 3 (최근 30일)
pritha
pritha 2024년 1월 7일
댓글: pritha 2024년 1월 10일
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
David Goodmanson
David Goodmanson 2024년 1월 7일
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 2024년 1월 7일
Hi David,
Thank you for your reply. If i consider the upper limit as 15-20? How will it be constructed in MatLab?

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2024년 1월 7일
이동: Torsten 2024년 1월 7일
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
Torsten
Torsten 2024년 1월 10일
편집: Torsten 2024년 1월 10일
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 2024년 1월 10일
Thanks a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by