Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Background MATLAB has many built-in functions, but unfortunately there are many functions in the real world. Your task is to write custom functions that may
Background MATLAB has many built-in functions, but unfortunately there are many functions in the real world. Your task is to write custom functions that may come in handy later. If you store these functions in a folder that you've saved to your path list ("Set Path" from toolbar, then add the folder), then you can call them in any program you write Problem Part 1 For each of the following 3D shapes, write a function that takes however many inputs are necessary and returns two outputs: volume and surface area. Be sure to explain the inputs and outputs in the comment headings! Shape Cube Rectangular prism Cylinder Cone Sphere General ellipsoid Function name CubeVolSA RecPrismVolSA CylVolSA ConeVolSA SphereVolSA EllVolSA Number inputs 1 input 3 inputs 2 inputs 2 inputs 1 input 3 inputs S2 (a bac bc)1/ where p 1.6075) Part 2 Create an .m file (not a custom function) called PA1part2 with the sections shown. NO numbers should appear after the Declarations section! %% Declarations (each variable on its own line) % Anonymous functions (again, each function on its own line) OblSphVolFracUnc; %% Calculations (three volumes, three uncertainties, six lines) %% Output (display the results using fprintf) Do NOT use the input function for any variables. The user will manually define the variables' values. Define two anonymous functions: one for the fractional uncertainty of a two-variable equation and one for the volume of an oblate spheroid 4 "Calculations" should calculate the volume given R and H and the associated uncertainty. You should use your functions from Part 1 for the cone and cylinder. The "Output" section should present your results using fprintf for all three shapes with t and 3 symbols and THREE values after the decimal. Assume that the units are in centimeters in your output and when you comment your variables
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