How to plot graphs iteratively or using for loop on the same figure?
古いコメントを表示
I have datasets that I can use to plot several graphs on the same time scale. For example the time variable is t and the variable for vertical axis is y1, y2, y3, ... y10. Manually I can use these codes: figure; hold; plot(t, y1); plot(t, y2); plot(t, y3); ... plot(t, y10);
But, how to simplify the process using iterative or for loop? The manual method will be a problem if there are many graphs to plot. We cannot manually type for example plot(t,y1) up to plot(t, y50).
Would appreciate if anyone can provide a simple code based on the example given.
Thank you.
3 件のコメント
KSSV
2017 年 12 月 26 日
How you have the variables y1,y2...yn in your work space? A matrix? A matfile? A text file?
Mohd Sapiee
2017 年 12 月 26 日
Mohd Sapiee
2017 年 12 月 27 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!