Azzera filtri
Azzera filtri

summation

5 visualizzazioni (ultimi 30 giorni)
amar kshirsagar
amar kshirsagar il 28 Set 2011
how to implement summation in matlab Is there any function for 2D summation in matlab

Risposte (2)

TAB
TAB il 28 Set 2011
A=rand(5);
As=sum(sum(A));
  3 Commenti
Andrei Bobrov
Andrei Bobrov il 28 Set 2011
Hi Jan!
A= rand(5000);
tic,sum(sum(A));toc
tic,sum(A(:));toc
clear A
Elapsed time is 0.037663 seconds.
Elapsed time is 0.037902 seconds.
MATLAB R2010a, Intel Core2 Duo, 2.13 GHz, 2 GB RAM
TAB
TAB il 28 Set 2011
On Matlab R2007a , C2D, 4GB RAM
A= rand(5000);
tic,sum(sum(A));toc --> 0.047444 Sec
tic,sum(A(:));toc --> 0.047441 Sec
Yes, Andrei's version is faster. :-)

Accedi per commentare.


Andrei Bobrov
Andrei Bobrov il 28 Set 2011
sum(A(:)) % A - double array 2d

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by