Help regarding solving equations
古いコメントを表示
I am trying to solve a iterative design problem using programming.
Design Problem
Determine Flow depth (d) for following conditions:
Diameter of sewer (D) = 200mm
Discharge through sewer (Q) = 122.3 LPM
Sewer Material = Concrete, Manning's coefficient = 0.013
Longitudinal slope = 1 in 1000.
The algorithm is:
i. Assume a value of a, which is in between 0 to 360.
ii. Calculate the other parameters ar, A, P, R, Qi. (Formulas are as mentioned in code).
iii. Compare that Qi to Qd (Pre defined as numeric value), if both are same then proceed for printing calculated variables, if not then repeat the process again until Qi = Qd.
I had tried this code, I used for loop but it is not working, and I tried while loop, it is struck in calculations.
D = 200; %Diameter of sewer in mm
D = D/1000; %dia in meter
n = 0.013; %Manning's coefficient
S0 = 1/1000; %Bed slope
Q = 122.3; %LPM
Qd = Q/(1000*60); % Discharge in LPM to Cumecs
n = 360;
for a = 1:1:n
ar = a*0.0174; %theta in radians
A = ((D^2)/8)*(ar-sin(a));
P = (ar*D)/2;
R = A/P;
Qi = (A/n)*(R^(2/3))*sqrt(S0);
while Qi == Qd
fprintf('Area of flow is %d \n',A);
fprintf('Discharge is %.5f \n', Qi);
end
while Qi~ Qd
a= a+1 && a<360;
end
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Mathematics and Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!