help with MATLAB
ENGINEERING PROBLEM Consider a gradually varied flow in an open channel of a circular cross section at a given discharge Q. it is convenient to express the cross sectional area and the wetted perimeter in terms of the diameter of the circular cross sectional area and the angle theta, expressed in radians, as depicted in the figure below. The expressions are PO) = OD AO) 2 D 8 (20 sin(20)) B D 20 y To study the channel of the water depth along the channel, the following function is of interest 1- Fr f(0) = Here, s is the channel slope and the function slopes and the Froude number Fr are defined as B S P 10/3 Fr = 2 9A Where n is the manning's roughness coefficient, Q is the discharge, B is the free-surface width, as depicted in the figure above, and g=9.81 m/s^2 is the acceleration due to gravity. To do; implement a series of matlab function that can be used by an engineer in charge of designing a circular open channel MATLAB TASKS 1. Implement basic expressions and use of loops. Create a matlab function such that if you're given: two angles e, and e two values of the diameter of circular cross section D and D Manning's coefficient n Channel slopes Discharge Q Integer number M b Returns: A matrix F of dimension 2 x M. The first row of F will contain the values of the function f() for a set of M angles equally between eande (including the given values and ex) for the diameter D. The second brown of F will contain the values of the function f(O)for a set of Mangles equally spaces between eande (including the given values of e, and e) for the diameter D The angle e such that the value of the function fat o is the maximum of all the values off between and e ,, for the diameter Da 1 The angle o such that the value of the function fat e is the maximum of all the values off between e and e z. for the diameter D 1 Produces; A figure representing the value fas a function of the anglefor both diameters D and D 2. Create a Matlab function that, given two angles 01 and 82, 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 offis close to the given design value fo. 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 off (for D = 1m and for the angle within the range given by 01 and 2) 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. write a message on the screen detailing if 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(angle1, angle2, n, slope, Q, M, fo) Note: The matlab header must be function [F, angleA, angleB] plotf (angle1, angle2, Da, Db, n, slope, Q, M) The name of the Matlab file must be plot. m =