Question

4.3 Subfunctions D Modify cylinderInfo.m, so that the function returns the volume and area of a cylinder, given the height an  

(MATLAB QUESTION)

function [ volume , area ] = cylinderInfo( height , radius )
%

%
end

function [ volume ] = calcVolume( height , radius )
%

%

function [ area ] = calcSurfArea( height , radius )
%

%
end

0 0
Add a comment Improve this question Transcribed image text
Answer #1

%calcVolume.m

function [volume] = calcVolume(height,radius)

volume=pi*radius*radius*height;
end

============================================================================================

%calcSurfArea.m

function [area] = calcSurfArea(height,radius)

area= 2*pi*radius*(radius+height);
end

============================================================================================

%cylinderInfo.m

function [volume,area] = cylinderInfo(height,radius)

volume=calcVolume(height,radius);
area=calcSurfArea(height,radius);


end

============================================================================================

Output

MAILAB R2018a PUE ISH Leg n Run Sect on Compare ▼ GoTo▼ Comment 36.は rder Naw Cpen Save Breakpoints Run Run and Adance Run an

Add a comment
Know the answer?
Add Answer to:
   (MATLAB QUESTION) function [ volume , area ] = cylinderInfo( height , radius ) %...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (MATLAB QUESTION) How to modify this function? function [ varargout ] = ellipsoidInfo( varargin ) %...

    (MATLAB QUESTION) How to modify this function? function [ varargout ] = ellipsoidInfo( varargin ) % enter code/comments here end 4.4 Advanced Functions Modify ellipsoidinfo.m, so that the function returns some information about an ellipsoid (or sphere) depending on the user's supplied input and expected output If the user supplies one input, the function will calculate information for a sphere If the user supplies three inputs, the function will calculate information for an ellipsoid. The user would supply the values...

  • Write a user-defined MATLAB function that will calculate the area/volume of a shape whose dimensions are...

    Write a user-defined MATLAB function that will calculate the area/volume of a shape whose dimensions are given by the user. This function will be able to calculate the area for 2D objects like a triangle or a rectangle and 3D objects such as a box. The name of the function will be findArea and it will have four input arguments. The first input argument will be the length. The second input argument will be the width. The third input argument...

  • 6. Consider a cylinder with a surface area of 2 m2. Find the radius r and...

    6. Consider a cylinder with a surface area of 2 m2. Find the radius r and height h of such a cylinder so that the volume of the cylinder is a maximum. Given: For a cylinder, the surface area is S = 2^r2 + 2trh and the volume is V = arh (where r is the radius and h is the height of the cylinder). I (5)

  • Write a program that asks the user to input the radius and height of a cylinder...

    Write a program that asks the user to input the radius and height of a cylinder and the unit weight of the material (in pounds per square feet). The program computes the surface area of the cylinder and the total weight of the cylinder. The program uses two functions: One function to read the data from the keyboard, the other function to calculate the surface area and the weight of the cylinder. The weight of the cylinder is printed from...

  • Using MATLAB 18. A cylinder with base radius r and height h is con- structed inside...

    Using MATLAB 18. A cylinder with base radius r and height h is con- structed inside a sphere such that it is in contact with the surface of a sphere, as shown in the figー ure. The radius of the sphere is R- 11 in. (a) Create a polynomial expression for the vol- / >1 ume V of the cylinder in terms of h. (b) Make a plot of V versus h for 0 shs11 in. (c) Using the roots...

  • QUESTION 4 Find the surface area of a cylinder with a radius of 3 and a...

    QUESTION 4 Find the surface area of a cylinder with a radius of 3 and a height of 10. The surface area is TT units (Do not use pi in your answer as it is already written with the units above) QUESTION 5 Find the volume of a cone with a radius of 6 and a height of 8. The volume is IT units (Do not use pi in your answer as it is already written with the units above)...

  • question on matlab. this is for a function. the question is "write a function called tri_area...

    question on matlab. this is for a function. the question is "write a function called tri_area that returns the area of a triangle with base b and height h, where b and h are input arguments of the function in that order "

  • MatLab question, please answer in matlab. %{ Write a function that prints the area and circumference...

    MatLab question, please answer in matlab. %{ Write a function that prints the area and circumference of a circle for a given radius. Only the radius is passed to the function. The function does not return any values. The area is given by pi*r^2 and the circumference is 2*pi*r. The function is called areaCircum. Example: areaCircum(input value) %} % Place your function call here

  • Exercise 1: A circle is defined by its radius (we are not interested in its center)....

    Exercise 1: A circle is defined by its radius (we are not interested in its center). A cylinder is defined by circle and height.  Design and implement a class called Circle that has the necessary attributes to describe it and at least the following member methods: setRadius( ), getRadius( ), Circumference( ), Area( ), Display( ), and two constructors, one is parameterized constructor and another empty constructor with default zero value.  Design and implement a class called Cylinder...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT