Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Faculty of Engineering First Year

Dept. of Computers and Systems Engg. Programming Language (2)

Take-HOMEWORK EXAM

[1] The velocity of a rocket launched straight up (neglecting air resistance) is given by: ( ( ) { ( ) )

Where: acceleration due to gravity (feet/sec2) = 32.17 m total initial rocket mass (slugs, slug* = weight) = mass of fuel, mf + mass of empty rocket, me u q t b speed of burning fuel mass exiting the rocket (feet/sec) rate of fuel mass loss (sec) time since launch (sec) the time at which we run out of fuel (stop burn time), sec

Note: qb= mf (1-1) Write a MATLAB function to plot velocity vs. time for a particular rocket. (1-2) Modify your function in (1-1) to plot also the height vs. time, below the plot of velocity vs. time curve. (1-3)Modify your function to make animation of velocity and height.
Page 1 of 4

(1-4) Run your program using These values: me=100 slugs. Mf= 100 slugs, u= 8000 ft/sec, q= 1 slug/sec.

[2] A cantilever beam with a length of m has a load placed on its end as shown below. The equation for the beam deflection is: ( where, F applied load (lbf) beam length (ft) area moment of inertia E Youngs constant = 10x106 psi )

(2-1)Design a MATLAB function to perform the calculations and plot the deflection y vs. x.

Load F

y
(2-1) Design a MATLAB function to perform the calculations and to plot the variation of deflection vs. the variation of length. (2-2) Test your program using the following data: F=20 Ibf, = 1ft and =0.075 in4 (2-3) Modify your function to make animation of deflection.
Page 2 of 4

[3] Write the function pythagorean, which takes two arguments a and b that represents the length of the legs of a right triangle and returns the length of the hypotenuse c and the smallest angle measurement (in degrees). Your function should accept vector inputs. Apply the function to calculate hypotenuse length and angle of triangles having legs 7.5 and 3.75 centimeters and 11.25 and 10 centimeters.

[4] The Fibonacci numbers follow the pattern 1,1,2,3,5,8,13, . , where each term(from the 3rd one) is the sum of the preceding two terms. The Fibonacci sequence occur throughout nature in the form of logarithmic spirals as found in the shell of a chambered nautilus, the tusks of an elephant, and patterns in sunflowers and pine cones ( f(n)=f(n-1)+f(n-2), n>2 ). (4-1) Design a MATLAB function to compute and print (in a column) the n Fibonacci numbers for a given positive integer number n. (4-2) Modify your program to compute the ratio Fk/Fk-1, k= 2,3, , n and plot the ratio as a function of k. (4-3) What you notice about this ratio as n increases?

[5] The (fictional) endangered floppy-eared rock wallaby lives near a newly installed highway, where conservation groups are concerned that the too many wallabies are becoming roadkill for the population to be sustainable. In each week, there is a probability p that any individual wallaby will be killed on the road, i.e. the population of wallabies decays with the decay with a decay rate of p per week. Suppose that the initial number of wallabies is N0. (5-1) Write a MATLAB program which computes the number of wallabies remaining, N(t) ( where t represents time as 1 week, 2 weeks, 3 weeks, and so on
Page 3 of 4

up to 1 year, i.e. 52 weeks ), based on p=0.02. You should treat this as a simulation and not as a theoretical calculation of the expected number of wallabies. Present your data as a bar plot. (5-2) Modify your code from part (5-1) to plot the number of remaining wallabies as circles. Superimpose on this data the analytic result: ( ) Where N(t) is the number of remaining wallabies at time t, N0 is the initial number of wallabies, and p is the decay constant. (5-3) Modify the program in part (5-1) to compute the half-life of the wallaby population, that is, the time required for half of the wallabies to become roadkill.

[6] Design a MATLAB program to solve a ballistics problem by using symbolic mathematics. The inputs are the initial velocity, the gravitational acceleration, and the computation time. The substation of these inputs should be at the proper steps of your program. The program should include the following: (6-1) The symbolic solution of the distance traveled when the projectile hits the ground. (6-2) The plotting of the trajectory. (6-3) The computation of the maximum range and angle where the maximum range occurs.

Good Luck,

Prof. M. Moness

Page 4 of 4

You might also like