Ask Question, Ask an Expert

+61-413 786 465

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

Assignmentafter the success of your robo-advice venture you

Assignment After the success of your robo-advice venture you decide to explore alternative sources of profitability for your company. You realize that Australian investors are often forced to chose between expensive acti ...

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Suppose that you have used some concept learning algorithm

Suppose that you have used some concept learning algorithm to learn a hypothesis h1 from some training data. You are interested in knowing the accuracy that the hypothesis can be expected to achieve on the underlying pop ...

Question 1 manipulate spectral imagehyperspectral images

Question 1. Manipulate spectral image Hyperspectral images can be seen as a generalisation of normal colour images such as RGB images. In a normal RGB colour image, there are 3 channels, i.e. channels for red colour, gre ...

Assignmentq1 find the laplace transforms of the following

Assignment Q.1 Find the Laplace transforms of the following functions: (a) t 2 + at + b and (b) sin(2nΠt/T) Q.2 Find f (t) for the following F(s) = α[ f (t)]. (i) 5/(s + 3), (ii) 1/s 2 + 25, (iii) 1/s(s+1) Q.3 Find the L ...

Lab assignment - matlab matrix relationallogical operators

Lab Assignment - MATLAB Matrix, Relational/Logical Operators and Plotting This laboratory exercise/assignment will involve you 1) practicing multiplication operators in MATLAB; 2) practicing relational and logical operat ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

  • 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

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As