{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ChE 210 Quiz 1 - space MATLAB code is expec be marked...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: space. MATLAB code is expec be marked incorrect. You Will turn in yo g = 1; DEZ; / “3/ .553; __,,_ Cf; ? e>1 i"(l *C)>a) r: 7 Q C 3 a = 3i *c))a '3» else ( _ a = b + c " a =3 end WW/(F -..--‘J r 9 r )2 b = a + CA2, ~ / S .. What aretflaluesga and/l)?aftér~tfi“”"ir'sc is executed? o :3 b c.‘ l 2 2. Evaluate the following expressions and state 'rraL :l true or false value. ta “Ho ’ JR “‘5‘” a(5>4)&(('8+43)<11) , 1 ‘2x 0 / l fill/0V 0 e o c. ~= 4i’~< 6 <(<4*2/8l+4 > 4 ~s+lyie< 4+4) 4’ r~C 4’ ,J 6 I L 45,35) 0 l N o I 5L. / 3. One of the important facilities in MATLAB is the ability to write and execute user written functions. The arguments area /U ' ('I' l‘-.l.-'-\.TL£}\B syntaxwrlte a functiLii'irilnoleslPflLDr- {(P)ressure{ jinlunie;_;antiiljDemperatge. molfifi‘tfiugeme hree supplied arg n s its-eeicu‘rzfie and rei‘tiffi‘tfie number 'of moles tn) of aficcording to the Ideal Gas Law. PV = nRT RT — The Temper hich is one of the arguments is expected to be in degrees ,. K centigrade Celcius but the correct units for the ideal gas law are degrée.$.,.._|§elvin‘:i Degrees C can e converted to degrees {SApxgij‘l’vfdding 273-15- k g C7273J 5 The value R in this equation is the universal gas constant and for the units that will be used in this function its value is: 3. ,fi “can “I 82.057 m an" / ." W. p? “A! g g _ mole 0K tunrtian M: malts (p’vfi') K T»: TT271|5\ T =‘Tr273J5 j , \/ w {2282057 Re 82.067 3 4. How many times will the following loop be executed? 0:0? Cr? (4'5 i=9; lsé - whilei~=0 "3 5. Write a function called myMin4 that will take irL,_s§p‘a~ratepumperg‘a‘svargumentém7 and return the minimum. You may not use built-in MATLAB functions such as min() or sort(). Also 0 not use vectors in your code. As an example of how myMin4 should work. y = myMin4(8,9,3,4) returns y = 3 tun+wfl 19:,“3 4- 3m ,5: "2 J i { Cl 4b ilk/(MU )8; l: «7.x «('04) U 5 Gt J go * ~ l5e I; Lb(C-)g<(b(ol) “yv 33):) am it‘ (cw) /‘ JJC (“(86 I j if 71 3/ (2 / lg; - . 0 Me, U; . Can/filo” Jays/U ': ‘* C b; M //fi<7 / / a, 6. What are the three major building blocks of structured algorithms? In other words what are the three types o/fprocessing found in structured programming. a. Séqrtm 2‘ch b. chit/‘on / c. Cane/ltd»!er Write a short efficient script that calculates tf thésquarespf the first N positive, odd integers beginning with 1 (1, 3, , ). Your script may not use the sum function. It should work in the following manner: >>> myscript What is N: 5 The answer is: 35 N'3 input (iiédlmitgA/Z’) Pl 2 0 , 6 ,. ’1 ’ Zflrbfi Mr» 744 l o , g 00 \\.t.MV//U ~ Mercf‘z/ . SN 1 / W6 .. k '- t4 ‘ Q: q +Y I fez- “VD N; “‘1 if (NJ (5 \La'r N /\ x §pfcn+f~ (‘nihzwswo/ 15 $\) at ...
View Full Document

{[ snackBarMessage ]}