フィルターのクリア

How can I combine plots in same axes?

1 回表示 (過去 30 日間)
Ana Carolina da Silva Pacheco
Ana Carolina da Silva Pacheco 2022 年 5 月 6 日
I want to combine all plots in same axes, I tried to use hold on and hold off but it didn't work. Can anybody help me? Here's a part of the code:
for i=1:it
if i<=3
figure('Color','w');
hold on; box on; grid on;
params.flag_plot = 0;
npts = 41;
ec_max_vec = ec_max + linspace(0,abs(ec_max),npts);
Mtotal = zeros(npts,1);
Ntotal = zeros(npts,1);
for pt=1:npts
ec_max = ec_max_vec(pt);
x = fminbnd(@(x) EquilibriumVerification(x,ec_max,params,d,fy,Es,ey,Ast,b,h,ft,Ec,ec0,k3,fc,ecu),0,h,options);
[Fs,Fcc,Fct,Mc,Ms] = ComputeForcesAndMoments(ec_max_vec(pt),x,params,d,fy,Es,ey,Ast,b,h,ft,Ec,ec0,k3,fc,ecu);
Mtotal(pt) = Mc + Ms;
if (sign(Mc)~=sign(Ms))
disp('Here')
pause
end
Ntotal(pt) = Fs + Fcc + Fct;
end
plot(abs(ec_max_vec),abs(Mtotal)/100,'-b','DisplayName','Bending Moment (kN.m)')
plot(abs(ec_max_vec),Ntotal,'--r','DisplayName','Error (kN)')
l1 = legend;
set(l1,'Location','Southeast')
xlim([0 abs(ec_max_vec(1))])
xlabel('\epsilon_c_m_a_x','FontName',params.font_name,'FontAngle','italic','FontSize',params.font_size)
end
end
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 5 月 6 日
xlim([0 abs(ec_max_vec(1))])
You will need to track the maximum abs() over all of the plots and xlim with that after the loops
Also you should probably
ylim auto
after all the loops
Ana Carolina da Silva Pacheco
Ana Carolina da Silva Pacheco 2022 年 5 月 6 日
Thank you so much, it worked.

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by