"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?

 採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 8 日

0 投票

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

1 件のコメント

Ian
Ian 2012 年 7 月 8 日
This suggestion corrected the problem. Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by