Calculating integral but weird result :S

조회 수: 5 (최근 30일)
Serhat
Serhat 2013년 1월 30일
Hi,
I am trying to calculate this integral.
sigmaZ= -0.1464*eye(4);
f = @(x)(arrayfun(@(x)(1./(det(sigmaZ./sin(x).^2 + eye(4)))),x))
out = (1/pi)*quad(f,0,pi)
but it gives this result 3e+10. It must not have been that high. Is my integral wrong?
Thanks:)

채택된 답변

Teja Muppirala
Teja Muppirala 2013년 1월 30일
When sigmaZ is negative, the integrand blows up around x = 0.3 and x = 2.7 and you have a singularity which you cannot integrate.
For example, just plot it:
sigmaZ= -0.1464*eye(4);
f = @(x)(arrayfun(@(x)(1./(det(sigmaZ./sin(x).^2 + eye(4)))),x))
ezplot(f)
When sigmaZ is positive, the integrand is always finite for x in [0 pi] and so you don't get any problem.
  댓글 수: 1
Serhat
Serhat 2013년 1월 30일
Hımm, Isee. Then the problem is sigmaZ. Thanks for help:)

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

추가 답변 (1개)

Jan
Jan 2013년 1월 30일
Is there any chance that we can guess what you want to calculate?
  댓글 수: 1
Jan
Jan 2013년 1월 30일
편집: Jan 2013년 1월 30일
@Serhat: All you have shown us is the code and you explain, that it could be wrong. But we cannot suggest an improvement, when you do not explain, which equation this code should solve. And if this is still not clear, a simplified version:
I have c = a + b, where a is 2 and b is 3. I get the result 5, but I want 6. Where is the error?
Without a magic crystal ball it is impossible to find an answer.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by