R H I T

advertisement
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
EXAM 4
NAME ___________________________________________
SECTION NUMBER _______________________________
CAMPUS MAILBOX NUMBER _____________________
Problem 1
/ 60
Problem 2
/ 40
Total
/ 100
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
Problem 1 (60 pts)
Name this program lastname_firstname_problem1.m (all lower case).
We will be modeling the motion of a pendulum.
(a) The motion of a pendulum for small angles is a sine wave. Suppose that we pull the pendulum back
to an angle of –/3 radians and release it. The sine wave solution for the angle of the pendulum is given
by
/3
2
where is the pendulum angle, measured from the vertical, the length of the pendulum
9.81 / , and is time.
Plot this equation for 0
2 ,
. Make sure that the curve is reasonably smooth, and give your plot
good axis labels.
(b) For larger angles the true pendulum equations of motion can only be solved numerically. The
equations for the pendulum motion are
0
3
where
sin 0
0
is the angular velocity of the pendulum.
Calculate the Euler solution to these equations. Use
0.001
and solve the equations while
Add this solution to your plot. (It should be similar to the answer in part a, but not exactly the same.)
Give the plot a good title and an appropriate legend.
0.
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
Comp Apps I
Problem 2 (40 pts)
For this problem, name your main program lastname_firstname_problem2.m and your function
lastname_firstname_ellipse.m (all lower case).
We will be creating a “flower” from ellipses:
15
10
5
0
-5
-10
-15
-15
-10
-5
0
5
10
15
(a) The equations for the x and y coordinates of an ellipse are given by
cos cos
cos sin
Here




and
sin sin
sin cos
are the coordinates of the center of the ellipse
and are the semi-major and semi-minor axes of the ellipse
is the angle of the ellipse with respect to the x axis
goes from 0 to 360 degrees to create the ellipse
Write a function that takes
,
, , , and
as inputs and plots a single ellipse.
(b) Write a main routine that loops over many
,
, and
values to create the flower.
Draw ellipses for from 0 degrees to 360 degrees, in 10 degree increments. For each of those ellipses,
the center coordinates of the ellipse are given by
cos
sin
Set
10,
2, and
5. Add the command “axis equal” as the last line of your main
routine to make the flower come out with the correct aspect ratio (nice and round).
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
Department of Mechanical Engineering
ME 123
When you are done, post your m-file answer to the correct folder:
1. Double-click on “Documents” on your desktop.
2. Double-click on “DFS Root” on the left column.
3. Double-click on AcademicAffairs.
4. Double-click on ME.
5. Double-click on ME123.
6. Double-click on Exams.
7. Double-click on the folder with your section number.
8. Copy and paste your m-file to this folder.
Comp Apps I
Download