Taking a descend interval

5 ビュー (過去 30 日間)
Jane Smith
Jane Smith 2021 年 3 月 5 日
コメント済み: Jane Smith 2021 年 3 月 5 日
for t=1:n
[L(t)]=(1/(50)^(t))
[C(t)]=(1/(800))^(t);
end
For the 1st line (L(t)) i need to use the interval 1:n however for the 2nd line i need from n:1. How do i change t without changing the interval in the for loop?

採用された回答

Alan Stevens
Alan Stevens 2021 年 3 月 5 日
Insert
tau = n+1-t;
then raise 1/800 to the power tau.
  1 件のコメント
Jane Smith
Jane Smith 2021 年 3 月 5 日
Worked perfectly! Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by