I need to plot multiple functions in one plot, in one figure, within a for loop

2 ビュー (過去 30 日間)
Hanna Smith
Hanna Smith 2020 年 3 月 5 日
コメント済み: Hanna Smith 2020 年 3 月 5 日
I need to plot multiple functions in one plot, in one figure, within a for loop. I've tried putting 'hold on' in a trillion different places in the for loop with no success.
X and Y are defined earlier in the code
X = [0.3, 0.5, 0.7, 2.5];
Y= [2, 4, 6, 8];
  1 件のコメント
Bob Thompson
Bob Thompson 2020 年 3 月 5 日
For the record, it is better if you paste the code directly, instead of an image. That way we can just copy the text.
What is t?
I suspect that the issue is calling out 'figure' within the loop, which will specify a new figure each loop. Try moving that outside the loop.

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

採用された回答

darova
darova 2020 年 3 月 5 日
What about figure?
  1 件のコメント
Hanna Smith
Hanna Smith 2020 年 3 月 5 日
Thank you so much! That worked, you are a life saver!

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

その他の回答 (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