Problem with if and else and else
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all,
I have a problem which i despiratly need an help with.
The idea I am think of is a suituation were if the first if statment is ok trhen the porgram stop however if the condition is not met, it moves to the next which i represent here with elseif and so on till the last elseif ststment.
Please I will appreaciate all contribution
if (0.04<=t_1/Do<0.05) % If condition
t_1 = Pd*di/(2*k*Fy) % Determine the minimum thickness
Do = di + 2*t_1 % Define the external diameter
elseif (0.04<=t_2/D1<0.05) % Elseif condition for the second round
t_2 = (Pd-Pe)*D1/2*k*Fy %Determine the minimum thickness
D1 = di + 2*t_2 %Define the external Diameter
elseif (0.04<=t_3/D2<0.05) %elseif condition for the final round
t_3 = D2/(((4*Fy)/(Y_sc*Ym*(Pd-Pe)*sqrt(3))) + 1) %Determine the minimum thickness
D2 = di + 2*t_3 %Define the external Diameter
end
0 件のコメント
採用された回答
David Hill
2020 年 1 月 13 日
if 0.04<=t_1/Do&&t_1/Do<0.05 %need &&
t_1 = Pd*di/(2*k*Fy);
Do = di + 2*t_1;
elseif 0.04<=t_2/D1&&t_2/D1<0.05
t_2 = (Pd-Pe)*D1/2*k*Fy;
D1 = di + 2*t_2;
elseif 0.04<=t_3/D2&&t_3/D2<0.05
t_3 = D2/(((4*Fy)/(Y_sc*Ym*(Pd-Pe)*sqrt(3))) + 1);
D2 = di + 2*t_3;
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!