summation

조회 수: 5 (최근 30일)
amar kshirsagar
amar kshirsagar 2011년 9월 28일
how to implement summation in matlab Is there any function for 2D summation in matlab

답변 (2개)

TAB
TAB 2011년 9월 28일
A=rand(5);
As=sum(sum(A));
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2011년 9월 28일
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 2011년 9월 28일
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. :-)

댓글을 달려면 로그인하십시오.


Andrei Bobrov
Andrei Bobrov 2011년 9월 28일
sum(A(:)) % A - double array 2d

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by