フィルターのクリア

How do I get a loop to return all the values that I am looking for at one time?

1 回表示 (過去 30 日間)
John Woods
John Woods 2020 年 6 月 12 日
コメント済み: madhan ravi 2020 年 6 月 13 日
The loop I have runs 56 times and with each iteration, it only adds one value. So the first time it loops, it only shows one value, the second time it shows two and so on. How do I get all 56 values to return at once? This is what I have:
e=0:200:11000;
for i=1:length(e)
Re=6.37e6;
g0=9.80665;
g(i)=g0*((Re^2)/((e(i)+Re).^2))
end

回答 (1 件)

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2020 年 6 月 13 日
e=0:200:11000;
i=1:length(e)
Re=6.37e6;
g0=9.80665;
g=g0*((Re^2)./((e(i)+Re).^2))
  2 件のコメント
John Woods
John Woods 2020 年 6 月 13 日
Thank you!
madhan ravi
madhan ravi 2020 年 6 月 13 日
The line i is not needed here.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by