Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask MATLAB Expert

The tank in the water tower has the geometry shown in figure below (the lower part is a cylinder and the upper part is an inverted frustum cone).  Inside the tank there is a float that indicates the level of the water.
 You will be writing a function that determines the volume of the water in the tank from the position (height h) of the float.  This function will be called cs151sp13assn7 and there will be one input argument to the function that represents the height of the water in meters (this value could come in as a matrix of multiple water values).  There are no output variables for this function.

NOTE: You may be using if statements, the find function and the any function to help you with the steps outlined below.  There may be a combination of these commands or you may have a different way to solve it.  However, you may NOT use any loop commands to solve the problem.

1037_loop comand.png

A Step-by-step Procedure

1.  Create the correct function header as defined above.

2.  Check to see if there are any heights within the matrix that will cause the water to overflow the tank or if there are any values that are negative.  In either of these cases, your function should display an error message and stop processing.

3.  Find all the heights that are less than or equal to 24 meters.

4.  Print out how many values meet the criteria in step 3.

5.  If there are any values less than or equal to 24 meters, then find out the volume of these water levels using the equation: v = Π (14.5)2h.

6.  Print out these values using the fprintf command (see the ex below for what the output will look like – note that the height and volume values are printed out to two decimal places).

7.  Redo steps 3 through 6 for heights that are greater than 24 meters and use the volume equation: v = Π (14.5)2 (24) + 1/3 Π (h – 24) (14.52 + 14.5rh+rh2) where rh = 14.5 + 11.5/21 (h – 24).

ex Output

>> cs151sp13assn7([24 25 26 27 23 22 28 0 1])
There are 5 values below (and including) 24
For h = 24.00 m, the volume is 15852.48 m^3
For h = 23.00 m, the volume is 15191.96 m^3
For h = 22.00 m, the volume is 14531.44 m^3
For h = 0.00 m, the volume is 0.00 m^3
For h = 1.00 m, the volume is 660.52 m^3
There are 4 values above 24
For h = 25.00 m, the volume is 16538.26 m^3
For h = 26.00 m, the volume is 17275.81 m^3
For h = 27.00 m, the volume is 18067.03 m^3
For h = 28.00 m, the volume is 18913.79 m^3
>> cs151sp13assn7([25 26 27 28])
There are 0 values below (and including) 24
There are 4 values above 24
For h = 25.00 m, the volume is 16538.26 m^3
For h = 26.00 m, the volume is 17275.81 m^3
For h = 27.00 m, the volume is 18067.03 m^3
For h = 28.00 m, the volume is 18913.79 m^3
>> cs151sp13assn7([24 46 26 27 23 22 28 0 1])
Invalid values are in the matrix, please rerun function with valid values
>> cs151sp13assn7([45 24 0])
There are 2 values below (and including) 24
For h = 24.00 m, the volume is 15852.48 m^3
For h = 0.00 m, the volume is 0.00 m^3
There are 1 values above 24
For h = 45.00 m, the volume is 43632.79 m^3
>> cs151sp13assn7([45 -2 0])
Invalid values are in the matrix, please rerun function with valid values

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M9407
  • Price:- $65

Guranteed 36 Hours Delivery, In Price:- $65

Have any Question? 


Related Questions in MATLAB

Reports of projectproblem design a fourbar grashof

REPORTS OF PROJECT PROBLEM: Design a fourbar Grashof crank-rocker to give? (Everyone will determine the terms given by professor) of rocker rotation with equal time forward and back, from a constant speed motor input. 1- ...

Car parking systema building of 10 floors is used for

CAR PARKING SYSTEM A building of 10 floors is used for parking cars. The area of each floor can be used for parking 100 cars. An automatic parking system is used to detect which parking slot is free at each moment. So, t ...

Problem 1 10pts the csu-chill radar made observations of

Problem 1 [10pts.]: The CSU-CHILL radar made observations of the Ponnequin Wind Farm located on the boarder of Wyoming and Colorado near I-25. The wind farm is approximately 62 km away from the radar. Complex valued digi ...

1 calculate the following for the function f x e-3x -

1) Calculate the following for the function f (x) = e -3x - 2x a. Calculate the derivative of the function by hand. Write a MATLAB function that calculates the derivative of this function and calculate the derivative at ...

Use matlab to solve the following equations please i plot

Use Matlab to solve the following equations. Please (i) plot the solution as a function of t for t  ∈ [0, 100]. (ii) draw the phase diagram of the ODE. 1. dy/dt = y 2 + y with y(0) = 1         dy 1 /dt = y 2 2.           ...

Question 1backgroundclimate change is a change in global or

QUESTION 1 Background Climate change is a change in global or regional climate patterns, in particular a change apparent from the mid to late 20th century onwards and attributed largely to the increased levels of atmosph ...

Question 1backgroundyou have been asked to manage a project

QUESTION 1 Background You have been asked to manage a project to install a pipeline from an offshore gas platform to an onshore gas processing plant, and to find the cheapest design that is possible. The platform is Q km ...

Instructions for each of the following exercise create an

Instructions: For each of the following exercise, create an M-file to store the MATLAB commands. Copy and paste the M-file into a text document. Include in the text document the pictures produced by MATLAB. Resize and cr ...

Matlabproject descriptionwrite a mileage per gallons and

MATLAB Project description: Write a mileage per Gallons and miles per dollar calculator program using two functions, one to calculate MPG and one to calculate MPD. The application will prompt the user to type the odm rea ...

Plotting and computer animation in matlabinstructions for

Plotting and computer animation in MATLAB Instructions: For each of the following exercise, create an M-file to store the MATLAB commands. Copy and paste the M-file into a text document. For problems 1 and 2, include in ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen