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

Introduction to programming in matlab1 working with matlab

Introduction to Programming in MATLAB 1. Working with MATLAB scalars, vectors, and complex numbers. Using MATLAB, define a unique variable for the following quantities. a. 5 (ex. Define x = 5, etc.) b. 25 2 c. (3 + 4??) ...

Provide matlab code as per the research paperresearch paper

Provide MATLAB code as per the research paper. Research paper - Decimeter-Level Localization with a Single WiFi Access Point We present Chronos, a system that enables a single WiFi access point to localize clients to wit ...

Labobjectiveslearn how to create vectors and matrices in

Lab Objectives ? Learn how to create vectors and matrices in MATLAB ? Become familiar with some of the built-in MATLAB functions and how they work Deliverables ? Submit your pre-lab answers in Bblearn under the Lab 2 pre ...

1 write a matlab script that will solve the system of

1. Write a Matlab script that will solve the system of linear equations shown below. This can be done by solving for the vector of unknowns (X) in the equation AX=B where A is the coefficient matrix and B is the vector o ...

Qestion 11 introductionmeasurements have been made of a

Question 1: 1 Introduction: Measurements have been made of a cantilever beam's deflection (stored in the file ass2q1in.csv). You must determine what type of loading has been applied and the magnitude of the load. There a ...

Problem -the state estimation equation in the discrete

Problem - The state estimation equation in the discrete Kalman filter is x ^ (n|n) = A(n - 1)x ^ (n - 1|n - 1) + K(n)[y(n) - C(n)A(n - 1)x ^ (n - 1|n - 1)] Thus, given the state transition matrix A(n) and the observation ...

Algorithms assignmentthe following 3 tasks are to be

Algorithms Assignment The following 3 tasks are to be completed for Homework 1 - using the following MATLAB syntax for the script file "bike.m" 1) Write additional syntax to create an INPUT variable named time and prompt ...

Question 11 introductionmeasurements have been made of a

Question 1: 1 Introduction: Measurements have been made of a cantilever beam's deflection (stored in the file ass2q1in.csv). You must determine what type of loading has been applied and the magnitude of the load. There a ...

Implement copy-move image forgery detection in matlabpaper

Implement Copy-move image forgery detection in Matlab. Paper - Copy-move image forgery detection based on Gabor magnitude by Jen-Chun Lee. With advancement of media editing software, even people who are not image process ...

Problem - the state estimation equation in the discrete

Problem - The state estimation equation in the discrete Kalman filter is x ^ (n|n) = A(n - 1)x ^ (n - 1|n - 1) + K(n)[y(n) - C(n)A(n - 1)x ^ (n - 1|n - 1)] Thus, given the state transition matrix A(n) and the observation ...

  • 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

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate