Vous êtes sur la page 1sur 13

Department of Civil Engineering

De Salle University - Manila


LBYCVN1: CIVIL ENGINEERING COMPUTER METHODS

PROBLEM NO. 1 – Roots of Nonlinear Equations Date Submitted: October 23, 2018

CHECKLIST for LBYCVN1 Matlab Problem #1

__________ I. (20 pts). The problem, theory and equations in Part (a) are described
completely. The presentation is very orderly and systematic.
__________ II. (20 pts) Part (b). The solution and plots/tables are presented.
__________ II. (40 pts) Part (c). The solution and plots/tables are presented clearly.
There is a discussion of results and a conclusion.
__________ III. (20 pts) Part (d). The scripts are presented completely with comments.
The scripts are easy to understand.
__________ Total

Remarks:

NAME:
Balcos, Marla Felicity M.
11532149
I. Problem Description
The given parameters are as follows,

𝑏 = 15 𝑚
𝑚3
𝑄 = 22
𝑠
𝑆 = 0.00025
𝑛 = 0.013

Figure 1. Cross-section of the open channel


The Manning’s equation is used to solve for the normal depth, d (depicted above), is as follows.
𝐴 2/3 1/2
𝑄= 𝑅 𝑆 (1)
𝑛
Where,
The area of the section, A is

𝐴 = 𝑏𝑑
The hydraulic radius, R is
𝐴
𝑅=
𝑃
And the wetted perimeter, P is
𝑃 = 𝑏 + 2𝑑
Substituting into Equation (1) and transposing Q, the nonlinear equation to solve for the normal depth can
be derived and is as follows,

𝑏𝑑 𝑏𝑑 2/3 1/2
𝐹(𝑑) = ( ) 𝑆 −𝑄 (2)
𝑛 𝑏 + 2𝑑
To solve for the root of the nonlinear equation, which is also the normal depth of the section, the Incremental
Search Method and the Secant Method would be utilized. The steps for both methods are as follows:
1. Incremental Search Method
a. Start with the first root, 𝑥𝑖 = 0, and set the increment as ∆𝑥 = 0.1
b. Compute 𝑥𝑖+1 = 𝑥𝑖 + ∆𝑥
c. Substitute the values into the nonlinear equation.
d. Calculate the product of 𝐹(𝑥0 ) and 𝐹(𝑥1 )
- If the product is positive, replace 𝑥𝑖 by 𝑥𝑖+1
e. Repeat steps a-d until the product is negative. Then, proceed to the Secant Method
- If the product is 0, the root is 𝑥𝑖+1
2. Secant Method
Given that 𝑥𝑖 = 𝑥1 , and 𝑥𝑖+1 = 𝑥2 ,
a. The root lies between 𝑥1 and 𝑥2 .
b. Calculate a third value between 𝑥1 and 𝑥2 , taken as
𝑥1 𝐹(𝑥2 ) − 𝑥2 𝐹(𝑥1 )
𝑥3 =
𝐹(𝑥2 ) − 𝐹(𝑥1 )
c. Replace 𝑥1 by 𝑥2 , and 𝑥2 by 𝑥3 .
d. Repeat steps a-c until 𝐹(𝑥3 ) = 0.00001
e. Therefore, 𝑥3 is the root of the nonlinear equation.

II. Results and Analysis


(b) Solve for d using the given values of b, Q, n, and S. Plot the nonlinear equation for solving d.
Table 1. Values solved for the Incremental Search Method

𝑥𝑖 𝑥𝑖+1 𝐹(𝑥𝑖 ) 𝐹(𝑥𝑖+1 ) Product


0 0.1 -22 -21.6104 475.4289
0.1 0.2 -21.6104 -20.7738 448.931
0.2 0.3 -20.7738 -19.6106 407.3864
0.3 0.4 -19.6106 -18.1732 356.3856
0.4 0.5 -18.1732 -16.4955 299.7759
0.5 0.6 -16.4955 -14.6025 240.8753
0.6 0.7 -14.6025 -12.5133 182.7256
0.7 0.8 -12.5133 -10.2441 128.1877
0.8 0.9 -10.2441 -7.80801 79.98583
0.9 1 -7.80801 -5.21662 40.73139
1 1.1 -5.21662 -2.47995 12.93695
1.1 1.2 -2.47995 0.393123 -0.97492

Table 1 shows the values solve, utilizing the steps for the Incremental Search Method. The root lies
between 1.1 and 1.2 as the product of 𝐹(1.1) and 𝐹(1.2) is negative. The Secant Method, then is used to
obtain the root.
Table 2. Values solved for the Secant Method

𝑥1 𝑥2 𝐹(𝑥1 ) 𝐹(𝑥2 ) 𝑥3 𝐹(𝑥3 )


1.1 1.2 -2.47995 0.393123 1.186317 -0.00776
1.2 1.186317 0.393123 -0.00776 1.186582 -2.3E-05

Table 2 shows the values obtained with the Secant Method. The root of the nonlinear equation is
found to be 1.185682 as the value of 𝐹(𝑥3 ) is less than the margin of error of 0.00001.
Therefore, the normal depth of the section is
𝑑 = 1.186582 𝑚
From the MATLAB script, the normal depth of the section is also
𝑑 = 1.186582 𝑚

Figure 2. Plot of the nonlinear equation


Figure 2 shows the plot of the normal depth, d against the nonlinear equation, F(d). With constant
values of Q, b, n, and S, the value obtained from the nonlinear equation is seen to increase with the increase
of the normal depth.
(c) Solve for d if b varies from 10 m to 40 m at increment of 5. Plot the nonlinear equations in one figure
for comparison. Plot d vs b for constant Q. Discuss the effect of b.
Table 3. The normal depths of the bases
b (m) d (m)
10 1.594
15 1.187
20 0.977
25 0.845
30 0.753
35 0.683
40 0.529

Table 3 shows the corresponding normal depths of the bases varying from 10 to 40 m. The depths
are seen to decrease as the base increases.

Figure 3. Plot of the nonlinear equations


The plots of the nonlinear equations of the varying bases are shown in Figure 3. The plot with the
base of 40 m is the steepest, while the plot of the nonlinear equation with the base of 10 m has a more
gradual incline. As a result, the value of the normal depth decreases starting from the one obtained with the
10-m base to the one obtained with the 40-m base.
Figure 4. Plot of the values of the base vs the normal depth
The plot of the base against the depth is seen on Figure 4. It can be concluded that the relationship
between b and d is inverse as d increases while b decreases. The normal depth is defined as the depth of
flow where the slope of the bed and the channel is equal, while the water depth remains constant. As the
values of Q, n, and S remain constant, decreasing the base would make the water level rise, resulting to a
greater normal depth. The graph is also asymptotic to the both axes, denoting that b and d cannot be zero
as they are both dimensions of the channel.
III. Appendix
Balcos_Problem1a.m
%Derive the nonlinear equation in terms of b, d.

%Manning's Equation
fprintf('Q = (A/n)*((R)^(2/3))*((S)^(1/2))\n')

%Area of the rectangular section


fprintf('Since A = bd,\n')

%Wetted Perimeter of the section


fprintf('P = b + 2d\n')

%Hydraulic Radius
fprintf('and R = A/P\n')

fprintf('Incorporating these relationships in the equation, we get\n')

%Manning's equation in terms of b and d


fprintf('Q = (bd/n)*((bd/(b + 2d))^(2/3))*((S)^(1/2))\n')

%The nonlinear equation to solve for d


fprintf('The nonlinear equation in terms of b and d is then,\n')
fprintf('F(d) = (bd/n)*((bd/(b + 2d))^(2/3))*((S)^(1/2))-Q\n')
Balcos_Problem1b.m
%The given parameters are the ff:
b=15;
Q=22;
S=0.00025;
y=0;
n=0.013;
prod=1;
h=0.1;
z=0;

%If prod is greater than 0, the process will repeat itself


while prod>0

%Transfer the value of y to x


x=y;
%Set the increment as 0.1
inc=0.1;
%Set the value of y to be x plus the increment
y = x + inc;

%Substitute the value of x and y to the nonlinear equation into f and g, respectively
f = (b*x/n)*((b*x/(b+2*x))^(2/3))*(S)^(1/2)-Q;
g = (b*y/n)*((b*y/(b+2*y))^(2/3))*(S)^(1/2)-Q;

%Get the product of f and g


prod = f*g;
end

%The process will repeat until the absolute value of h is greater than the margin of error of 0.00001
while abs(h) > 0.00001

%Calculate a third value, z between x and y


z = ((x.*g)-(y*f))/(g-f);
%Substitute z into the nonlinear equation
h = (b*z/n)*((b*z/(b+2*z))^(2/3))*(S)^(1/2)-Q;
%Transfer the value of y to x
x=y;
%Transfer the value of z to y
y=z;
%Transfer the value of g to f
f=g;
%Transfer the value of h to g
g=h;
end

%Display the value of the normal depth


fprintf('d = %.6fm\n', x);

%Plot the nonlinear equation


x=0:10:100;
y=(b.*x./n).*((b.*x./(b+2.*x)).^(2/3))*(S).^(1/2)-Q;
plot(x,y)
xlabel('d')
ylabel('F(d)')

Balcos_Problem1c.m
%Loop for when b varies from 10 to 40 with increments of 5
for b = 10:5:40

%The given parameters are the ff:


Q=22;
S=0.00025;
y=0;
n=0.013;
prod=1;
h=0.1;
z=0;

%If prod is greater than 0, the process will repeat itself


while prod>0

%Transfer the value of y to x


x=y;
%Set the increment as 0.1
inc=0.1;
%Set the value of y to be x plus the increment
y = x + inc;

%Substitute the value of x and y to the nonlinear equation into f and g, respectively
f = (b*x/n)*((b*x/(b+2*x))^(2/3))*(S)^(1/2)-Q;
g = (b*y/n)*((b*y/(b+2*y))^(2/3))*(S)^(1/2)-Q;

%Get the product of f and g


prod = f*g;
end

%The process will repeat until the absolute value of h is greater than the margin of error of 0.00001
while abs(h) > 0.00001

%Calculate a third value, z between x and y


z = ((x.*g)-(y*f))/(g-f);
%Substitute z into the nonlinear equation
h = (b*z/n)*((b*z/(b+2*z))^(2/3))*(S)^(1/2)-Q;
%Transfer the value of y to x
x=y;
%Transfer the value of z to y
y=z;
%Transfer the value of g to f
f=g;
%Transfer the value of h to g
g=h;
end

%Display the value of the normal depth of the given base


fprintf('When b = %.2fm, d = %.3fm\n', b, z);

%Plot the nonlinear equation for each of the bases


x=0:10:100;
y=(b.*x./n).*((b.*x./(b+2.*x)).^(2/3))*(S).^(1/2)-Q;
plot(x,y)
xlabel('d')
ylabel('F(d)')
hold on

end
hold off

Balcos_Problem1c2.m
%Initialize the value of i
i=1;

%Loop for when b varies from 1 to 100 with increments of 1


for b = 1:1:100
%Q = A/n * R^2/3 * S^1/2
%The given parameters are the ff:
Q=22;
S=0.00025;
y=0;
n=0.013;
prod=1;
h=0.1;
z=0;

%If prod is greater than 0, the process will repeat itself


while prod>0

%Transfer the value of y to x


x=y;
%Set the increment as 0.1
inc=0.1;
%Set the value of y to be x plus the increment
y = x + inc;

%Substitute the value of x and y to the nonlinear equation into f and g, respectively
f = (b*x/n)*((b*x/(b+2*x))^(2/3))*(S)^(1/2)-Q;
g = (b*y/n)*((b*y/(b+2*y))^(2/3))*(S)^(1/2)-Q;

%Get the product of f and g


prod = f*g;
end

%The process will repeat until the absolute value of h is greater than the margin of error of 0.00001
while abs(h) > 0.00001
%Calculate a third value, z between x and y
z = ((x.*g)-(y*f))/(g-f);
%Substitute z into the nonlinear equation
h = (b*z/n)*((b*z/(b+2*z))^(2/3))*(S)^(1/2)-Q;
%Transfer the value of y to x
x=y;
%Transfer the value of z to y
y=z;
%Transfer the value of g to f
f=g;
%Transfer the value of h to g
g=h;
end

%Set the ith value of the array, depth to be equal to z


depth(i)=z;
%To set the value of the depth of the next base to z, add 1 to i
i=i+1;
end

%Plot of b vs d
base = 1:1:100;
plot (base, depth)
xlabel('d (m)')
ylabel('b (m)')

Vous aimerez peut-être aussi