Question: MATLAB Lab 4 ( Function ) Note: For all labs and assignments copy and paste into a Word file your program ( script file )
MATLAB Lab Function
Note: For all labs and assignments copy and paste into a Word file your program script
file the relevant command window and plots if applicable. Try to condense the printout
as best as possible.
Objective
Introduction to user defined functions in MATLAB.
Procedures
The objective of this exercise is to minimize the total surface area of a cylindrical metal can for a
given volume and compare that area to that of a sphere of equal volume. Assume that the volume
is equal to ~~
For this exercise, first create two user function files:
cylinder.m Inputs radius, height Outputs volume, area
sphere.m Input radius Outputs volume, area
Next create a MATLAB program script m file to perform the following steps:
For cylinder:
Display table headings for cylinder radius, height, volume and area
For radius values of to in steps of
Compute the height resulting in constant volume
Call cylinder.m to calculate and return cylinder volume and area
Display the results formatted to significant figures
Find and display the minimum cylinder area and corresponding radius and height.
For sphere:
Calculate and display the sphere radius for a volume of
Call sphere.m to calculate, return and display sphere volume and area.
Finally, compare the minimum cylinder area to the sphere's area.
A program template ENGRLabtemplate.m is shown below and can be downloaded
from WebCampus.
Formulas
Cylinder: volume area
sidestopbottom
Sphere: volume area
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
