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!