Optimized solution for a function with two integrals which depend on each other
이전 댓글 표시
Hi everyone,
I have already created a code which numerically calculates the following function:

As you can see the inner integral depends on the outer one via 'q'. The inner integral is solved with the integral command
G_inner_integral = integral (@(y) inner_function(y),0,2*pi,'ArrayValued',true);
for every iteration inside a for loop, in which via trapezoidal rule the outer integral and therefore the whole function is approximated.
Is it possible to discard the for loop and solve it in a more clever way, maybe even within a few commands (with the help of functions like cumtrapz, trapz, or integral)? I have tried a some of those approaches but with no desired result.
P.S Prefer the numerical solution as the functions inside the integrals are quite complex and therefore time consuming for any analytical approach.
Thank you in advance
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

