how can i do this summation
Afficher commentaires plus anciens
I have two summation ,a=0 to a=m+1 and b=0 to b=n+1,where m=100,n=50.?
8 commentaires
Azzi Abdelmalek
le 18 Sep 2013
If m=2 and n=3 what should be the result?
Azzi Abdelmalek
le 18 Sep 2013
Ok, show us the result for m=3 and n=2
Mary Jon
le 18 Sep 2013
Azzi Abdelmalek
le 18 Sep 2013
This is not clear
Mary Jon
le 18 Sep 2013
Modifié(e) : Azzi Abdelmalek
le 18 Sep 2013
Azzi Abdelmalek
le 18 Sep 2013
a and b are not used in your sum. What are i and j? what is k?
Mary Jon
le 18 Sep 2013
Modifié(e) : Azzi Abdelmalek
le 18 Sep 2013
Réponse acceptée
Plus de réponses (2)
Azzi Abdelmalek
le 18 Sep 2013
m=100
out=sum(0:m)
Walter Roberson
le 18 Sep 2013
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 commentaires
Mary Jon
le 18 Sep 2013
Walter Roberson
le 18 Sep 2013
MATLAB 7... you mean R14? Is it at least R14SP1 ?
Mary Jon
le 20 Sep 2013
Catégories
En savoir plus sur Function Creation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!