How to integrate 3-dimensional numerical array into one dimension using Parallel Computing Toolbox?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
Chunru
am 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.
3 Kommentare
Chunru
am 10 Aug. 2021
% Try the following along the 1st dim
% The syntax with dim is for the so-called 'Composite array', see doc
% distributed
xd = distributed(rand(20,8,6));
y = squeeze(trapz(xd))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!