Page 1 of 1

MATLAB

Posted: Sun May 15, 2022 11:58 am
by answerhappygod
MATLAB
Matlab 1
Matlab 1 (39.12 KiB) Viewed 50 times
Matlab 2
Matlab 2 (23.27 KiB) Viewed 50 times
Matlab 3
Matlab 3 (21.7 KiB) Viewed 50 times
Matlab 4
Matlab 4 (10.36 KiB) Viewed 50 times
HANDS-ON 4 Figure 1 shows two rectangular gates which are fully and partially submerged in water. The hydrostatic force, F, acting on these gates can be calculated as: F = pod A where pis the fluid density, g is the gravitational acceleration, dis centroid depth and A is the wetted area. For the fully submerged gate (y>h), the wetted area and centroid depth are given by: 4=bh d where b and h are the width and height of the gate respectively, and a =y-h. The water depth, y is taken to be positive upward with respect to the channel bed. For the partially submerged gate (y Sh), the wetted area and centroid depth are given by: A = by Based on the information given, (0) Based on the conditions in Table 1(a), complete the flow chart in Table 1(b) to determine the hydrostatic force, F, acting on the gate for any given water depth, y. Complete the MATLAB code in Table 1(e) (use if statement) to calculate the hydrostatic force, F, acting on the gate for any given water depth, y. Get the input data from user. Include in the code, the ability to check that the values of h, b and y are greater than zero and display "Please check input data" if they are not. Display the output as the example shown in Table 1(a).

b b h h F y=0 y=0 77 (a) (b) Figure 1: Hydrostatic force acting on (a) fully submerged (b) partially submerged rectangular gates Table 1(a): Output Example Output Case Fully submerged gate (y> h) Partially submerged gate lysh) The gate is fully submerged. The hydrostatic force is 14.32 N. The gate is partially submerged. The hydrostatic force is 8.43 N.

Table 1(b): Flow chart Start Input rho, g, h, b, v No Yes No Yes End

Table 1(c): MATLAB code clear:clc Input data validate inputs calculate wetted area, centroid depth and force Display output