Sum function?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello Experts,
Consider I have to sum from i=1 to 2^(n-1) (n is given) values of some function f(i).
How can I do it like series in math sum from i=1 to 2^(n-1) of f(i)...
Thanks a lot in advance.
댓글 수: 0
채택된 답변
Naz
2011년 10월 15일
n=given;
i=1:2^(n-1); %gives you array of integers from 1,2,...2^(n-1)
% let's say your function is f=2i;
f=2*i;
yoursum=sum(f);
댓글 수: 2
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!