Plotting multiple plots on the same graph using a 'for' loop

The hold on command is not working in a 'for' loop, and I am ending up with 50 separate plots. How do I plot them on a single graph?

 採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 27 日

3 投票

Do not use figure() within the for loop.
figure(); %outside the loop
for K = 1 : 20
plot(rand(1,75));
hold on
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by