Multiple iterations for plotting

Hello dear,
I would like to request for your assistance to set a clear command for executing the iterations to plot the structural parameters in the code below. The code is not executing the needed iterations. The output is turning out only one value. I am hoping a single line of command will resolve the issue.
h= 0.5;
b = 0.5;
d1= 0.474;
d2= 0.035;
As= 2512*10^-6;
Asc= 2512*10^-6;
fy= 400*10^6;
Es= 200*10^9;
fc= 30*10^6;
fcd= 0.85*fc/1.5;
ecu= 0.0035;
ey= fy/Es;
for z= -1:0.3:2
es1= z*ey;
c= ecu * d1/(ecu - es1);
es2= ecu * (c - d2)/c;
fs1= es1 * Es;
fs2= es2 * Es;
end
if fs1> fy && fs1< -1*fy
fs1= fy;
%else fs1= fs1;
end
if fs2> fy && fs2< -1*fy
fs2= fy;
%else fs2= fy;
end
if fc<= 30
beta= 0.85;
else
beta= max (0.85 - 0.05*(fc-30)/7, 0.65);
end
% if c> h
% c = h;
% end
a= beta*c;
if a> h
a = h;
end
cb= d1 * (ecu/(ecu + ey));
Fcc= 0.85*fcd*a*b;
Fs= fs1 * As;
Fsc = fs2 * Asc;
if c >= cb
phi= 0.7;
elseif c < cb
phi= 0.9;
end
Nsd= phi*(0.85*fcd*a*b - fs1*As + fs2*Asc);
Msd= phi*(Fcc*(h/2-a/2) + Fsc*(h/2-d2) + Fs*(d1-h/2));
plot (Msd, Nsd);
xlabel ('Msd, kNm');
ylabel ('Nsd, kN');
title ('interaction diagram');

 採用された回答

Torsten
Torsten 2024 年 4 月 26 日

0 投票

Maybe you mean
h= 0.5;
b = 0.5;
d1= 0.474;
d2= 0.035;
As= 2512*10^-6;
Asc= 2512*10^-6;
fy= 400*10^6;
Es= 200*10^9;
fc= 30*10^6;
fcd= 0.85*fc/1.5;
ecu= 0.0035;
ey= fy/Es;
i = 0;
for z= -1:0.3:2
i=i+1;
es1= z*ey;
c= ecu * d1/(ecu - es1);
es2= ecu * (c - d2)/c;
fs1= es1 * Es;
fs2= es2 * Es;
%end
if fs1> fy && fs1< -1*fy
fs1= fy;
%else fs1= fs1;
end
if fs2> fy && fs2< -1*fy
fs2= fy;
%else fs2= fy;
end
if fc<= 30
beta= 0.85;
else
beta= max (0.85 - 0.05*(fc-30)/7, 0.65);
end
% if c> h
% c = h;
% end
a= beta*c;
if a> h
a = h;
end
cb= d1 * (ecu/(ecu + ey));
Fcc= 0.85*fcd*a*b;
Fs= fs1 * As;
Fsc = fs2 * Asc;
if c >= cb
phi= 0.7;
elseif c < cb
phi= 0.9;
end
Nsd(i)= phi*(0.85*fcd*a*b - fs1*As + fs2*Asc);
Msd(i)= phi*(Fcc*(h/2-a/2) + Fsc*(h/2-d2) + Fs*(d1-h/2));
end
plot (Msd, Nsd);
xlabel ('Msd, kNm');
ylabel ('Nsd, kN');
title ('interaction diagram');
But what about these if-statements ?
if fs1> fy && fs1< -1*fy
fs1= fy;
%else fs1= fs1;
end
if fs2> fy && fs2< -1*fy
fs2= fy;
%else fs2= fy;
end
How can a number be > 400*10^6 and at the same time be < -400*10^6 ?

2 件のコメント

Sam
Sam 2024 年 4 月 27 日
Dear Torsten,
Your first comment above has helped me iterate Nsd. Thank you very much. Now only Msd remains to be iterated. Any insight?
Sam
Sam 2024 年 4 月 27 日
Dear Torsten,
By dropping the semicolon after the formulas for Msd and Nsd, now the iterations for both values are coming up. But the plot is not showing the expected graph.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

質問済み:

Sam
2024 年 4 月 26 日

コメント済み:

Sam
2024 年 4 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by