Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show the code in MATLAB 2. (40 pt) In this problem you will practice symbolic expressions in MATLAB. Consider the surface area S and

image text in transcribed

Please show the code in MATLAB

2. (40 pt) In this problem you will practice symbolic expressions in MATLAB. Consider the surface area S and volume V of a cylinder to be S=2 Rh+2+R, V = nRh, where R and h are the radius and height of the cylinder, respectively. (a) Write a script that implements these two equations in MATLAB as symbolic equations. (b) Now create a user interface to allow the user to input the radius and height, one at a time. In your hints to the users, you should remind them that their inputs have to be in meters. If they enter negative values or non-numbers as the inputs, your code should display an error message and exit the program. (c) Now using the substitution function to replace the radius and height, and then calculate the surface area and volume. (d) Now output the surface area and volume in this format "The surface area is X m2, and the volume is Y m3". (Note that your outputs need to have four digits after the decimal). (e) Save the R,h, S, V variables into YourLast Name.txt in this format: R=XX m, h=YY m, S=ZZ m, V=TT m. Note that XX, YY, ZZ, and TT need to be replaced by the actual input and output of your program, and each of them needs to occupy 6 spaces with 2 digits after the decimal. You should use the append option so that the new inputs and outputs will not overwrite the old data

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago