Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The volume of a cylinder is calculated as V = r 2 h where r is the radius of the cylinder and h is the
The volume of a cylinder is calculated as
where is the radius of the cylinder and is the height of the cylinder.
Write a script that:
Computes the volume of a cylinder for several values of the height.
Assigns the height values to a row vector named The height values should satisfy the requirement that
with total values.
Assigns the resulting volume, with units of to a single variable named Vol.
Hint: read the comments for the provided lines to make sure your final answer is in the correct units.
As always, it is recommended to work in MATLAB then copy and paste your code to MATLAB Grader. Debugging is
much easier in MATLAB than in the Grader portal.
Also, be sure to comment your script accordingly. The above line assigns a random value to the radius of the cylinder.
The random value is different each time you run your code.
You should use the variable r in your definition of the volume, but you should not
try to alter it or redefine it differently from the locked line of code above.
That is you should not have any lines that look like r
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started