Simple Integration

조회 수: 1 (최근 30일)
Bibha
Bibha 2011년 5월 13일
Hi there,
I am new to MATLAB and have a simple question regarding the integration.
I have two expressions:
syms c L;
first = int( exp(-(L-3)^2/2, c, Inf);
second = int (first * exp(-(c-5)^2/.5), -Inf, Inf);
It gives me the integral of the first expression however on the second it says "Explicit integral could not be found". Then I also tried with quad but no avail.
what should I do to evaluate the second integral?
Many Thanks.

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 5월 13일
QUADGK works better for integrals that go to infinity:
syms c L;
first = int( exp(-(L-3)^2/2), c, Inf);
second = matlabFunction (first * exp(-(c-5)^2/.5));
quadgk(second,-inf,inf)
  댓글 수: 1
Bibha
Bibha 2011년 5월 13일
It worked!
Thanks! Thanks! Thanks and thanks.

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

추가 답변 (1개)

Ivan van der Kroon
Ivan van der Kroon 2011년 5월 13일
Bibha,
It get this answer for your third line (note also that on line two a right bracket is missing).
second =
infinity
/
| 2
| exp(-2.000000000 (c - 5) )
|
/
-infinity
1/2 1/2 1/2 1/2 1/2 1/2
(- 1/2 pi 2 erf(1/2 2 c - 3/2 2 ) + 1/2 pi 2 ) dc
I really do not think this integral can be evaluated explicitly. It is an error-function multiplied with a exponential function.
Ciao, Ivan
  댓글 수: 1
Bibha
Bibha 2011년 5월 13일
I think, I agree with you that the integral can NOT be evaluated explicitly. For that reason, I tried QUAD but I could not get it worked.
Any help on QUAD?

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

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by