フィルターのクリア

Iterate (repeat) a for-loop n times.

3 ビュー (過去 30 日間)
Sergey Dukman
Sergey Dukman 2019 年 3 月 3 日
編集済み: Star Strider 2019 年 3 月 3 日
Hello.
I am trying to repeat the for-loop n times. The point is that I want to take the values computed in the first iteration of the loop and then use those values in the second iteration of the same loop and so on. Does anybody can help me with that?
Here is my code:

採用された回答

Star Strider
Star Strider 2019 年 3 月 3 日
You posted an image of your code, not the code we can copy and run.
I would do something like this:
x = 0 : 0.01 : 5;
. . .
for kk = 1:numel(x)
. . .
end
Remember to subscript the values you want to save within the loop, for example:
y2(kk) = y1+h*k;
then plot after the loop (if you want to plot variables you computed in the loop).
  2 件のコメント
Sergey Dukman
Sergey Dukman 2019 年 3 月 3 日
編集済み: Sergey Dukman 2019 年 3 月 3 日
Thank you.
I will try your suggestion.
Could you also, please, explain to me what does "numel" command mean?
Best regards,
Sergey
Star Strider
Star Strider 2019 年 3 月 3 日
編集済み: Star Strider 2019 年 3 月 3 日
As always, my pleasure.
The numel function returns the number of elements in an array. For a vector, this is the same as length.
Also, I very much like your avatar (for obvious reasons)!
EDIT — Corrected typographical error.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by