Is there a way to vectorize trapezoidal numerical integration?
조회 수: 3 (최근 30일)
이전 댓글 표시
I was wondering whether there might be a way to (numerically) integrate several functions over different integration domains in a parallel manner. Using Matlab's trapz function, I can specify an "intergation domain"
X = [1 2.5 7 10];
and what essentially amount to the image of this vector under a set of, say, 3 different function
Y = [5.2 7.7 9.6 13.2;
4.8 7.0 10.5 14.5;
4.9 6.5 10.2 13.8];
Integration via trapz is then carried out as
trapz(X, Y, 2)
My problem is that I'd like to integrate each function over a different range. So essentially I'd like to have
X = [1 2.5 7 10;
3 4.1 8 11;
1 2.3 6 19];
Just for clarity: I can generate the desired result via a loop
for j = 1:3
out(j) = trapz(X(j,:), Y(j,:));
end
but since I am working with 1,000nds of function with 10,000nds of nodes in the integration domain this is not particularly expedient.
I'd very much appreciate it if anyone might have an idea how to go about parallelizing this task.
Many thanks.
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!