Doing a nested numerical integral in Matlab

조회 수: 7 (최근 30일)
L'O.G.
L'O.G. 2022년 12월 28일
편집: Torsten 2022년 12월 29일
How do I do the following nested integral in Matlab? The goal is to evaluate the following:
where the function ϕ is defined as
where . The notation seems a bit weird to me since the argument of ϕ in the second equation is only part of the argument where it appears in the first equation. I imagine that just means μ is re-defined in terms of itself. Assuming that's correct, how do I do this nested integral?

채택된 답변

Torsten
Torsten 2022년 12월 28일
mu = -20:0.01:20;
f = @(mu) integral2(@(u,sigma) sin(mu*sqrt(1-sigma.^2).*cos(pi/2*u)).*(sin(mu*sigma/2)).^2,0,1,0,1);
P = arrayfun(@(mu)f(mu),mu);
plot(mu,P)
  댓글 수: 2
L'O.G.
L'O.G. 2022년 12월 29일
arrayfun is slow, is there a faster option?
Torsten
Torsten 2022년 12월 29일
편집: Torsten 2022년 12월 29일
Yes, a for-loop over the elements of mu.
But I don't think that "arrayfun" is the time-consuming part - it's "integral2".

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by