Question: Give me a simple, brief MATLAB code to do the following, but strictly make sure that it fulfils all the requirements. given is a excel

Give me a simple, brief MATLAB code to do the following, but strictly make sure that it fulfils all the requirements. given is a excel file named EthanolPlantGivenDeltaP.xlsx. using this file create a general-purpose Matlab LiveScript that calculates the flowrate of a specified fluid through a long pipe of uniform diameter. the Programs should handle both laminar and turbulent flow. Displays a notice if the flow is transitional. Use a Drop Down control for specification of the liquid. Your program should support ethanol, toluene, and water. The default liquid should be water. Use Edit Field controls for the other program input. These should appear in the following order: Pipe inside diameter, in cm (default value, 4.0 cm). Pipe relative roughness, dimensionless (default value, 0). Note that this default value differs from the value in the spreadsheet. Pipe length, in m (default value, 50.0 m). Kinetic energy correction factor, , dimensionless (default value, 1.05). If the flow is laminar, this value should be ignored and a value of 2 used instead and a warning message should be displayed. Total minor losses loss coefficient, KL, dimensionless (default value, 0). Note that this default value differs from the value in the spreadsheet. If the flow is laminar, this value should be ignored, and a warning message should be issued. Elevation difference, in m (default value, 10). Pressure difference, in kPa (default value, 0). The local gravitational acceleration should not be an input to your program. Just hardcode9.81 m/s2. Use the Haaland expression to find the friction factor for turbulent flow. Use f =64/NRe for laminar flow (if included). Use Matlabs fzero function in place Excel Solver feature. Youll have to write an external (regular) function, call it myMEB, for use by fzero. This function should have the volumetric flow rate as its only argument (parameter), calculate the Reynolds number (NRe), and the friction factor (f), and return the net excess energy (based on the mechanical energy balance equation). I recommend the use global variables to transfer values, other than the volumetric flowrate, between your LiveScript and the external function. The use of global variables will produce warning messages in the current version of Matlab. However, with the current fzero function there is no alternative. See my example code and Matlab help for details. Since the myMEB function will be called multiple times by fzero during the solution process, dont include any I/O statements in it. Instead, use global variables to transfer the Reynolds number value (or a regime code) back to the LiveScript. The LiveScript can then use this value or code to display the appropriate messages and results. Im not certain that the last fzero call will be for flowrate associated with the final root, so Id call the myMEB directly with the root value in LiveScript and then check the flow regime and produce the output.

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 Programming Questions!