Trying to write a series: 2n+1
1 回表示 (過去 30 日間)
古いコメントを表示
I'm trying to write a 2n+1 series that starts at the number 2 and goes for 30 terms. How can I do this?
2 件のコメント
Jan
2013 年 2 月 18 日
It would work without a FOR loop also, if it works at all. Usually "n" is a natural number in problems related to series. But there is no natural number n such that 2*n+1 equals 2.
採用された回答
Youssef Khmou
2013 年 2 月 18 日
hi, try this :
% Sol1 : vectorized
serie1=2*[2:30]+1; figure, plot(serie1);
% Sol2 : loop
for x=2:30
serie2(x)=2*x+1;
end
serie2(1)=[]; figure, plot(serie2)
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!