new until matlab coding
DESCRIPTION
okTRANSCRIPT
3.0Solution to the Problem
3.1Analytical Problem
Force acting on dam
Force from the pressure distribution
Analytical diagram for each force (assuming breadth = 1)
At
At F1
From the hydrostatic equation, by assuming breath = 1
A
At F2
From the hydrostatic equation, by assuming breath = 1
A
At /
//
By assuming breadth = 1,
/ +
/What is the value of? Assume b = 1
For equilibrium dam, so that
(1)
and with
23.60kN/Hence, the following equation can be present in term of and
Then, substituted of these expression into equation 1
Thus, equation can be simplify into,
(2)After that, from the given , we can determine the by using and the equation (2) will be uses to determine the unknown . For the dam width, l specified, the angle,( and the maximum water depth, h are computed in the Table 1.
614.4788078275.96375653
918.3411524569.44395478
1221.5593547963.43494882
1524.3271161157.99461679
1826.7530299953.13010235
Table 1: The value for and for each given
3.2Numerical MethodNumerical method is the way to solve the mathematical problem by reformulated to be solved in arithmetic operation. From the equation (2), the following term of is uses in numerical method.
The equation can be approximated into:
The equation has rearranged by solving using Newton-Raphson Method as follow:
3.2.1Algorithm
1.Start
2.Input the value of dam width, l
3.Compute the value of theta
theta = atan(24/)
4.State the values that known as parameters, starting approximation for root, h, error, eps, tolerance, tol, maximum number of iteration, total, and first iteration, k
5.Predefined the function of f and its derivative, f1
f =(1.635*(h^3))+(3.27*(l^2)*h)-(183.895*(l^2))-(44.145/(sin(theta)^2))
f1 =(4.905*(h^2)) + (3.27*(l^2))6.Calculate for new root value, hnew
hnew = h-f/f1
7.Compute the absolute error, ea
eps = abs(hnew-h)
ea = eps/hnew
8.Show the values of the number of iteration, k, maximum height, h and absolute error, ea
9.Finish3.2.2Flowchart
3.2.3Coding Program
The maximum water height at every dam width can be compute by using Matlab coding as given below:
% Name : Muhammad Aliff Irfan Bin Mohd Suhaimi% IC Number: 940803035865% Matric Number: A12KM0249% Year/Course : 3rd year/Naval Architecture & Offshore Engineering% Project : 1% Lecturer : Dr. Yasser Mohamed Ahmed Abdel Razak% Date : 17 December 2014% to find the maximum water height, h (m) by using Newton-Raphson% equation of function in term of h,f(h) = (1.635*(h^3))+(3.27*(l^2)*h)-(183.895*(l^2))-(44.145/(sin(theta)^2))l = input('Dam Width (m) : ');theta = atan(24/l); % angleh = 24; % the value starting approximate to the rooteps = 1;tol = 10^(-14);total = 100;k = 0;format long;while ((eps > tol) & (k < total)) f = (1.635*(h^3))+(3.27*(l^2)*h)-(183.895*(l^2))-(44.145/(sin(theta)^2)); f1 = (4.905*(h^2))+(3.27*(l^2)); % First derivation at h = h_khnew = h-f/f1; % New approximation value for the rooteps = abs(hnew-h);h = hnew;k = k+1;ea = eps/hnew;fprintf('k = %2.0f, x = %12.10f, ea = %12.10f\n',k,h,ea);endF2
F1
A
W
C
F3
F1
F1
F2
C
+Type equation here.