two variables in while-loop

1 回表示 (過去 30 日間)
Bellahoug
Bellahoug 2018 年 9 月 12 日
回答済み: Walter Roberson 2018 年 9 月 12 日
I'm supposed to sum up the numbers
and figure out how many joints are needed for the sum to be bigger than 0.9977? I've figured out this much:
But the task says that it must be solved with the while-loop. And I do not get this when I have two variables, k and n. How do I put it into this:
? Please help me understand, I have really tried, but I'm new to both the subject and matlab.
  1 件のコメント
madhan ravi
madhan ravi 2018 年 9 月 12 日
Upload your code than a picture .

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 9 月 12 日
k = 0;
while sum < value
k = k + 1;
sum = ...
end
We recommend against naming a variable sum, due to the conflict with the very-often used sum() function. You should get into the habit of deliberately not naming variables sum: if you do not, then you are quite likely to end up with code that tries to use sum as a variable but also tries to use sum as a function.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by