Problem with if and else and else
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
David Hill
le 13 Jan 2020
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!