# HW2 - should read-in a value for the radius and display the...

This preview shows page 1. Sign up to view the full content.

Homework #2: Simple Programs with Input, Displays and if Statements Reading: 2.2.4, 2.6, 3.1, 3.3, 3.4.3 Homework: This assignment will be done entirely in MATLAB. When asked for a “program” you should create an m-ﬁle (script). Be sure to turn-in the completed script along with any runs you are asked for. When asked to “evaluate” you may use the command window as a scratch pad to complete the results. Turn problems in IN THE ORDER THEY ARE ASSIGNED. Each problem needs to be labeled so the TA can ﬁnd your work. Do the following exercises from your textbook 1. 2.11 2. 2.12 3. 3.1 all 4. 3.2 5. 3.6 Write a MATLAB script (m-ﬁle) that 6. Will calculate the volume and surface area of a SPHERE from the radius. Your script
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: should read-in a value for the radius and display the calculated values with appropriate units. The units should also be read-in. Test your program for r = 5 in and r = 12 mm. 7. Will perform a speciﬁed operation (addition, subtraction, multiplication, division) as input by the user for two variables also input by the user. Hint: Operation characters can be entered as character strings. The end result of your program should look some-thing like below >> operation Enter first variable: 5 Enter second variable: 4 Enter operation to be used [+,-,*,/]: + Result: 5+4 = 9 Test your program for a = 3 and b = 2 for all four operations....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online