create an increasing series

1 回表示 (過去 30 日間)
ektor
ektor 2023 年 9 月 21 日
編集済み: Walter Roberson 2023 年 9 月 21 日
Hi all,
I want to create
5
5(1+0.2^2)=
5(1+0.2^2+0.2^4)=
5(1+0.2^2+0.2^4+0.2^6)=
5(1+0.2^2+0.2^4+0.2^6+0.2^8)=
and so one up to 25 times.
Is there a way to do that in matlab?
Thank you!

採用された回答

Voss
Voss 2023 年 9 月 21 日
r = 0.2;
n = 25;
m = 5;
V = m*r.^(2*(0:n-1));
S = cumsum(V);
format long g
disp(S.')
5 5.2 5.208 5.20832 5.2083328 5.208333312 5.20833333248 5.2083333332992 5.20833333333197 5.20833333333328 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333 5.20833333333333

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by