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!