Question: Create a MATLAB function that, given two angles 01 and 02, the Manning's coefficient n. the channel slope So, the discharge Q, an integer number

 Create a MATLAB function that, given two angles 01 and 02,

Create a MATLAB function that, given two angles 01 and 02, the Manning's coefficient n. the channel slope So, the discharge Q, an integer number M and a design value fo, will find the diameter such that the maximum value off is close to the given design value fd. To do this, the program must start from a value of D=1m and compute the value off for a set of Mangles equally spaced between 1 and 02. The maximum value of f(for D-1m and for the angle within the range given by 01 and 02) will be computed and, if this number is close enough to the design value fo, the program will stop and return the value of the diameter. If not, the value of the diameter will be increased by 0.1m and the process will be repeated until a diameter is found or until the maximum allowed diameter of D-10m is reached. The program will return the diameter such that the maximum value of fis close to the given design value fo. A value of zero will be returned if no value of the diameter has been found to give a maximum of f close enough to the design value fo. a Write a message on the screen detailing if a diameter has been found or not. Note: To decide if the value of fis close enough to the design value fo, you need to check if the absolute value of the difference between fand fo is below 0.5. The MATLAB header must be: function D -diameter(anglel, angle2, n, slope, Q, M, fo) P(O)= 0D A(0) = (20 - sin(20) f(0) = 1-F2 So-sr Sf = no2p/ A1073 Fr = 0 V84" 1 I Create a MATLAB function that, given two angles 01 and 02, the Manning's coefficient n. the channel slope So, the discharge Q, an integer number M and a design value fo, will find the diameter such that the maximum value off is close to the given design value fd. To do this, the program must start from a value of D=1m and compute the value off for a set of Mangles equally spaced between 1 and 02. The maximum value of f(for D-1m and for the angle within the range given by 01 and 02) will be computed and, if this number is close enough to the design value fo, the program will stop and return the value of the diameter. If not, the value of the diameter will be increased by 0.1m and the process will be repeated until a diameter is found or until the maximum allowed diameter of D-10m is reached. The program will return the diameter such that the maximum value of fis close to the given design value fo. A value of zero will be returned if no value of the diameter has been found to give a maximum of f close enough to the design value fo. a Write a message on the screen detailing if a diameter has been found or not. Note: To decide if the value of fis close enough to the design value fo, you need to check if the absolute value of the difference between fand fo is below 0.5. The MATLAB header must be: function D -diameter(anglel, angle2, n, slope, Q, M, fo) P(O)= 0D A(0) = (20 - sin(20) f(0) = 1-F2 So-sr Sf = no2p/ A1073 Fr = 0 V84" 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!