R H I T

advertisement
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
FINAL EXAM – MATLAB Programming
NAME ___________________________________________
SECTION NUMBER _______________________________
CAMPUS MAILBOX NUMBER _____________________
EMAIL ADDRESS ________________________________@rose-hulman.edu
Problem 1 _________________/ 60
Problem 2 _________________/ 20
Problem 3 _________________/ 20
Total _____________________/ 100
Final Exam
Page 1 of 4
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
Problem 1 (60 points)
A simple robotic arm can be modeled as a pendulum, like in the picture to the right.
Let
be the angular displacement of the pendulum counterclockwise from the
downward position, and denote the angular velocity by . There is damping in the
pivot, and a force is applied horizontally to the lumped mass at the end of the
pendulum.
The equations governing the behavior of a particular pendulum are as follows:
d
0.4
t
20 sin
cos
d
t
where the units for
such that
and
are rad and rad/s, respectively, and time is in seconds. Suppose the applied force
0 when
0
2 when
0.
is
The initial conditions for the pendulum are
0
4 rad/s
0
0 rad.
Complete the following:
1.
(40 points) Use MATLAB to plot the pendulum’s angular displacement as a function of time , starting
at
0 s and ending at
4 s. Use a time step Δ
0.01 s. Be sure to properly label your axes and to
include a title.
2.
(20 points) Determine the values of and at
1.737s. Note that your time vector does not have this
exact value of time in it. Print these values to the screen using the following format:
Angular displacement at t = 1.737 s is X.XXX rad.
Angular velocity at t = 1.737 s is X.XXX rad/s.
Name your m-file lastname_firstname_problem1.m (all lower case). Instructions on posting this file to DFS are
found on Page 4.
Final Exam
Page 2 of 4
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
Problem 2 (20 points)
In this problem, you will be asked to write a MATLAB function which determines the volume of fluid, with a
variable height h, contained in a feeding trough with a geometry depicted below:
H=3m
h
R
L=5m
End View
Side View
The radius of the semi-circular base is 0.75 m. Your function should perform the following tasks in an efficient
way:

receive only one input variable h from a main calling code.

internally define a feeding trough height H of 3 m, a trough length L of 5 m, and a semi-circular radius R of
0.75 m.
check if the input is physically meaningful, i.e. fits within the physical constraints of the feeding trough. If
not, return a zero value for the output volume and print a warning message to the user:
Error message: Your input fluid level is outside the physical range!

return the fluid volume for the given fluid level h, in cubic meters, for the two cases:
Fluid level is in the semi-circular base:
sin  2   

V  R 2 L  

2 

where  is in radians and defined by


  cos1  1 
h

R
Fluid level is in the rectangular top:
V  2 R L h  R 

 R2
2
L
print out the result in the following format:
The total fluid volume is x.xxxxxe+xxx cubic meters at a fluid level of x.xxxe+xxx meters.
Name your function lastname_firstname_problem2.m (all lower case). Instructions on posting this file to DFS are
found on Page 4.
Final Exam
Page 3 of 4
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
Problem 3 (20 points)
Earth’s atmosphere can be divided into several layers. The tropopause, the boundary between the troposphere and
the stratosphere, begins at an altitude of 11.0 km (11,000m) and extends to an altitude of 25.0 km (25,000m). While
the temperature throughout this layer is approximately constant at 216.66 K, the following equation describes how
the air density, , changes with altitude, h:
where g is the gravitational acceleration (9.81 m/s2), R is the gas constant for air ( 287 J/(kg K) ), and T is the
temperature (216.66 K). The variables h0 and 0 are constant reference values of 11000 (meters) and 0.3648 (kg/m3),
respectively.
Your task is to write a MATLAB program to print a chart of altitude values from 11,000m to 25,000m along with
the corresponding values of air density TWO DIFFERENT WAYS. Specifically, your program should print the
chart using a “for” loop and then print it again using a “while” loop. In each case the chart should look the same. It
should look like the following:
Altitude (m)
-----------11000
12000
13000
14000
15000
16000
17000
18000
19000
20000
21000
22000
23000
24000
25000
Density (kg/m^3)
---------------0.3648
0.3116
0.2661
0.2273
0.1941
0.1658
0.1416
0.1209
0.1033
0.0882
0.0753
0.0643
0.0549
0.0469
0.0401
Name your code for this problem lastname_firstname_problem3.m (all lower case).
When you are done, post your m-file answer to the correct folder on DFS:
1. Double-click on “Documents” on your laptop.
2. Double-click on “DFS Root” on the left column.
4. Double-click on Academic Affairs.
5. Double-click on ME.
6. Double-click on ME123.
7. Double-click on Exams.
8. Double-click on the folder with your section number.
9. Copy and paste all your m-files to this folder.
Final Exam
Page 4 of 4
Download