for loop isn't working and I dont Know what i am doing wrong

1 回表示 (過去 30 日間)
Colby Jennings
Colby Jennings 2021 年 4 月 15 日
回答済み: Ahmed Redissi 2021 年 4 月 15 日
I am new to coding and matlab in general, what are the initial parameters I need to set?

回答 (1 件)

Ahmed Redissi
Ahmed Redissi 2021 年 4 月 15 日
First, initialize the variable you are going to use to store the sum to zero. Then iterate over the values of t and increment the value of F with the given expression for each value of t. See the code below:
F = 0;
for t = 1:1000
F = F+((1/4)^t)-((1/5)^t);
end

カテゴリ

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