how can i do this summation
조회 수: 1 (최근 30일)
이전 댓글 표시
I have two summation ,a=0 to a=m+1 and b=0 to b=n+1,where m=100,n=50.?
댓글 수: 8
채택된 답변
Azzi Abdelmalek
2013년 9월 18일
편집: Azzi Abdelmalek
2013년 9월 18일
s=zeros(1,88);
for k=1:88
for a=0:n+1
for b=0:m+1
s(k)=s(k)+v(a+1,b+1)^(k+1)-v(a+1,b+1)^k
end
end
end
s=s/(m*n)
댓글 수: 0
추가 답변 (2개)
Walter Roberson
2013년 9월 18일
Supposing that f(a,b) gives you the term you are summing, then
[A, B] = ndgrid(0:m+1, 0:n+1);
fAB = arrayfun(@f, A, B);
sum(fAB(:))
or
fAB = bsxfun(@f, (0:m+1).', 0:n+1);
sum(fAB(:))
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!