Lab06_Tasks

advertisement
Task 1
We’ve already explored using variables and input commands for this problem.
We’re going to improve the presentation of the results of this code.
To complete this task:
1)
2)
3)
4)
Re-save your lab05task1.m as lab06task1.m before you do any editing.
Be sure to adjust the initial comment lines for this problem if necessary.
Update your calculations to hide any intermediate calculations.
Add a prompt to ask the user what kind of material is being analyzed. (In the
sample output, the user entered “Steel Beam”.
5) After you’ve collected all the input, clear the screen.
6) Use fprintf to print your data into a clean, well-organized table. Note, the \n
and \t escape sequences may be helpful for alignment. NOTE: YOUR TABLE
CAN LOOK DIFFERENT – BE CREATIVE, BUT YOU MUST REPRINT ALL OF
THE VALUES!
7) Save and run your script often
Sample output:
Vibration Response
-----------------v0
= 15.00
x0
=
5.00
omega_n
= 90.00
omega_d
= 87.00
zeta
=
0.25
t
= 0.0360
phi
= 0.2635
of a Steel Beam
m/s
cm
rad/s
rad/s
sec
rad
-----------------Result:
x
= -0.0302 m
------------------
Task 2
Eighteen circular discs are to be cut from a piece of plywood in the organization
shown in the figure below. Each base has a diameter of D inches. Revise your
solution from the previous lab to make the output look more presentable, as shown
in the example below:
As a reminder, the questions you should be answering are:
a) Calculate the area of triangle ABC?
b) Calculate the waste material between X and Y above BC.
c) Calculate the dimensions of the minimum sheet of plywood needed.
d) Calculate the percentage of waste.
Sample Output:
Enter the diameter of each disc in inches:
Area of Triangle ABC:
Waste between XY above BC:
Width of Plywood:
Height of Plywood:
Percentage Waste:
10
43.30 in^2
10.73 in^2
50.00 in
35.98 in
21.42%
Task 3
(Note, this problem was previously used as a programming exam)
The mounting plate shown below is being machined from a solid block of metal. The
plate has an asymmetric chamfered corner and two (2) circular holes. Your task is
to prompt the user for the following information (unless noted, all units should be in
centimeters):
 The overall exterior dimensions of the plate (A & B in the drawing)
 The diameter of the 2 circular cut-outs (C & D in the drawing)
 The distance from the bottom of the plate to the start of the chamfered
corner on the left side of the plate (E in the drawing)
 The angle between the left side and chamfer in degrees (F in the drawing)
 The plate thickness (not shown in the drawing)
 The type of the material the block will be constructed out of
 The density of the material (in g/cm3)
Your task is to calculate and neatly print the mass of the final plate to 3 decimal
places. Sample input/output are shown below.
Sample Input/Output (User responses in bold):
Width of the Block (cm): 100
Height of the Block (cm): 120
Circle 1 Diameter (cm): 3.4
Circle 2 Diameter (cm): 10.6
Distance from Base to Chamfer (cm): 8.2
Angle of Chamfer (deg.): 126
Plate Thickness (cm): 3.1
Type of Material: Aluminum
Density of Material (g/cm^3): 2.70
Mass of the Aluminum Plate: 27627.775 grams
Download