"Reiman sum Help"

I am using MATLAB and I am tring to do a Reiman Sum I keep getting an error saying:
"
???Error using ==> mtimes
Inner matrix dimensions must agree.
"
My code is: {
n1 = [0:1:50];
N1 = 1 ./ ((2 .* n1 + 1)*(2 .* n1 + 2));
N1Sum = sum(N1) } I don't see the problem and have tried several variations. Does anyone see my error?

 Réponse acceptée

Walter Roberson
Walter Roberson le 8 Juil 2012

0 votes

N1 = 1 ./ ((2 .* n1 + 1) .* (2 .* n1 + 2));
Notice the .* instead of *

1 commentaire

Ian
Ian le 8 Juil 2012
This suggestion corrected the problem. Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by