Calculate sum of series using for
3 ビュー (過去 30 日間)
古いコメントを表示
Angel Hiram Torres Mota
2019 年 6 月 20 日
コメント済み: James Tursa
2019 年 6 月 20 日
I need help to calculate the sum of this example using only for.
Thanks for the help!
2 件のコメント
James Tursa
2019 年 6 月 20 日
編集済み: James Tursa
2019 年 6 月 20 日
What have you done so far? What specific problems are you having with your code? This is a very simple for-loop. Do you know how to write a for-loop?
採用された回答
James Tursa
2019 年 6 月 20 日
編集済み: James Tursa
2019 年 6 月 20 日
Here is an outline to get you started:
a = something; % you put a value here
m = something; % you put a value here
x = something; % you put a value here
y = 0; % the starting y value
for i=1:m % the for-loop indexing
% you put code here to add something to y
end % the end of the for-loop
See the Getting Started tutorials here:
3 件のコメント
James Tursa
2019 年 6 月 20 日
That's a good start at getting the values in. But in the for-loop, you want to be adding terms into y. The way you have it coded now, you are simply replacing the value of y with a new term. You need to correct the code inside the for-loop.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!