How to integrate 3-dimensional numerical array into one dimension using Parallel Computing Toolbox?

5 views (last 30 days)
Daiki on 9 Aug 2021
Commented: Daiki on 10 Aug 2021
I have a 3-dimensional array X to be numerically integrated with trapz function. The size of array is
size(X) = p,q,r
and the third dimension (size r) is to be integrated with an integral variable given by a vactor vx whose length is r. The result Y will be 2-dimensional matrix as
size(Y) = p,q
Then, how to calculate this numerical integration using GPU with Parallel Computing Toolbox?
Thank you.

Accepted Answer

Chunru on 9 Aug 2021
Xd= distributed(X, 3) % distributed along 3rd dim
Y = trapz(Xd, 3); % trapz support parallel processing for distributed input array
It might be better to use the 1st dimension as the integration dimension.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by