Hi, I want to plot around 30 graphs using for loop

1 回表示 (過去 30 日間)
Simon
Simon 2022 年 9 月 9 日
コメント済み: Jan 2022 年 9 月 10 日
So I'm trying to plot multiple graphs including multiple plots each using a for loop, it takes data from many matrices and plot them, the problem is that I only get one plot instead of 30, I don't get why here is my code:
for i=4:33
rpm=DataBFE{2,3}.OscillationAngle.data(:,1);
plot(rpm,Ref_model_value_2nd,'k')
hold on
plot(rpm,Ref_model_value_4th,'r')
plot(rpm,Ref_model_value_6th,'g')
plot(rpm,Ref_model_value_8th,'y')
plot(rpm,Ref_model_value_10th,'c')
plot(rpm,comb_models_values_2nd(i-3),'k','LineStyle','--')
plot(rpm,comb_models_values_4th(i-3),'r','LineStyle','--')
plot(rpm,comb_models_values_6th(i-3),'g','LineStyle','--')
plot(rpm,comb_models_values_8th(i-3),'y','LineStyle','--')
plot(rpm,comb_models_values_10th(i-3),'c','LineStyle','--')
%title('BigEnd -10 -10 -10 -10')
ylim([0 0.5])
xlabel('RPM')
ylabel('Osciallation angle')
hold on
legend('2nd order','4th order','6th order','8th order','10th order')
end
  6 件のコメント
dpb
dpb 2022 年 9 月 9 日
編集済み: dpb 2022 年 9 月 9 日
Of course. Use <See title documentation>. You have to have some way to programmatically define what the title string is going to be.
You had a title() command in there with a fixed text string for each; if you want something different on each you'll either have to create it from code with <compose> or <sscanf> and the loop index variable or store an array of titles for each to retrieve just like the plot data...your choice.
Jan
Jan 2022 年 9 月 10 日
@Simon: By the way, this is not twitter: no # before the tags.

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by