Vous êtes sur la page 1sur 3

Minia University Faculty of Engineering CSE Department First Year Programming Languages(2) ime allo!

e"# $ %our& Final E'am&((une) 2*+2) Attempt the following questions and assume any missing data. ,uestion (-) (2* ponts): Determine the results of the following assignment statements using MATLAB (1.1) q1 = ceil (-9.9) (1. ) q = ceil(9.9) (1.!) q! = floor(-9.9) (1.") q" = floor(9.9) (1.#) q# = roun$(-9.9) (1.%) q% = roun$(9.9) (1.&) q& = fi'(9.9) (1.() q( = fi'(-9.9) (1.9) q9 = a)s( ! * i+") (1.1,) q1, = - " . # . -1/.0 (1.11) q11 = sqrt( - " 1 91 -1%/ ) (1-1 ) q1 = 2Mohamee$2 == 2Mohammou$2 (1-1! q1! = strcm3(2Mohamee$2 . 2Mohammou$2 ) (1-1") q1" = strncm3i(2Mohamee$2.2Mohammou$2.") (1-1#) q1# = isstr3ro3(2Mohamee$2 .2u33er2) (1-1%) q1% = fin$str(2Mohamee$2.2e2) ,uestion(--)(+. points)# When a satellite orbits the Earth, the satellites orbit will form an ellipse with the Earth located at one of the focal points of the ellipse. The satellites orbit can be expressed in polar coordinates as
r = p 1 cos

where r and are the distance and angle of the satellite from the center of the Earth, p is a parameter specifying the size of the orbit, and is a parameter representing the eccentricity of the orbit. circ!lar orbit has an eccentricity of ". n elliptical orbit has an eccentricity of " # #1. $f % 1, the satellite follows a hyperbolic path and escapes from the Earths gra&itational field. 'onsider a satellite with a size parameter p ( 1""" )m. Write the necessary statements to plot the orbit of this satellite if* +a, ("+b, ( "../+c, ( "./.

SEE THE /E0 P12E

,UES -3/(---)(2* points)#0etermine the &al!e of ires at the end of each of the loops.
1+d, ires ( " for index1 ( 1"*2 .*4 for index. ( .*.*index1 if index. (( 5 brea) end ires ( ires 3 index.end end ires4 ( ires 1+c, ires ( "for index ( 1"*2.*4 if index (( 5 brea) end ires ( ires 3 indexend ires6 ( ires 1 1+b, ires ( "for index ( 1"*2.*4 if index (( 5 contin!eend ires ( ires 3 indexend ires. ( ires 1 1 +a, ires ( "for index ( 21"*1" ires ( ires 3 1end ires1 ( ires 11

,uestion(-4) (2* points)# The ratio of a circle7s circ!mference to its diameter, 5 can be comp!ted by !sing the following form!la*

4 = 1 1 1 1 1 + + +........ 6 / 9 8

0esign two : T; < f!nctions !sing the while2constr!ct and then the for2loop to comp!te 5 !p to some n2terms which yield an error e& /otes# +6 "efine input an" output arguments) 26 print t7e actual values of terms an" error using fprintf ,uestion (4) (2* points)# :any applications in science and engineering +s!ch as traffic engineers st!died the probability of k cars passing a gi&en location in a time inter&al of length t , ma)e !se of Poisson probability distribution f!nction* Write a f!nction to e&al!ate the =oisson distrib!tion for any k, t, and . You should make use of optional arguments to check for t, , and k.

SEE THE /E0 P12E

With my best wishes, Prof. M. Moness

SEE THE /E0 P12E

Vous aimerez peut-être aussi