Problem with if and else and else
1 次查看(过去 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!