You are on page 1of 4
EE loo Solve questions 1 and 2 and submit your printed program and printed results, Th "rest of the questions will be completed in the Lab, 1. PSpice is an analysis program but it has commands suitable for design such as PARAM Consider (hi cirenit shown below: 49 mG) « GJimaen, we wat 'o wity Ry, In order to find the resistor that absorbs maximum power and the Value of Use aorta power nisin, PSpibe. ‘The following is the eode: Max power. cir 01 0 20 320 2.0 10 12124 72206 ivary AL load resistor fron 0.1 upto 10 in steps of 0.01 AL 2 0 {R}; variable load resistor param R=2.4 ;usod by .op, ignored by .de ae paran 80.1510 0.01, probo | vend Ru PSpiceAD on the above file, then use PSpiceAD => Run Probe -> ‘Trace > add and type iu the “Trae Expression” I(RL}*V(2) the graph for the power in RL (y-axis) will appear versus RL (scaxis), search visually for he maiiourn value which is ISW ut RLA2A 2 As your liomeworks, for the cirenit shown below fd the value of A, tit makes the current Mowing iw fy = lef Use -patain command to vary &, through a suitable range o valnes and using Probe plot T(t) versus fee to tin ‘Une poine where (Fy) = 1.94 and read Ry. aoe = gig Mm of Va @)sov HZ wvE)ve vane ‘The following is an vmplementation of the g-funetion in ehapter 4 of Fledderniaan ancl Bradshaw i MATRA, A={5 ©7628 BA Glo o\2 oB OF 4S Lom bo wiht tb In NATIAB A> 1B # 2:4 bo a+ 2) Functions of NATEIK: 12h Types = § Ze (A) co andl 2B NACE Se Bat 13) 2- max(A) Sl A fo U- max (mox(a)) S12) B-min(a) 705, 4,98) mialmin(Ay) = bKtind (n> 2) co f be Nabe we — F- eng (Avo) IANS Te, a) os Sey aHtox EX? euray jes ial Gio Bl oss ¢ oo Ib 66 2B ay aI orl oF 4 hy iy Sf Ore ib ov i AA= Size(avrayt) B = arrayi@Uy1) C= A6raty| (Haig B ed D = adres (M1, 23 Bee Sink a (cay! ZE5) A= QM 54 PPL Ay € “= 21 2a 5 -: org ed fetes or ane = SU E= (4 b (go2e®) = 52 04H 24S 6j or = Rnb a pes ou pe Wahi s leh aie sae Gna tva tie ‘yale lengtn (p)-6 complex , roth + jeomlex fx: aS+d6 b= 7454 Atb = \24sigs a-b = -2~- 3) anh 2 em Ae alo = 0.626 WJoroz 31 compass (real , imag 1D Ex . Bea be compass (4, 4) Hy jh gees to S| “tea ¥ " TO node Js,5-1 Title 2 wav lags ¢ Sark 1 “ is 3 loglc=> ral ; i i 2p « ee ED spt’ et END cule oF Gabe Bs Lo te xo iwerter iad eS Ryu 2A Yy Ex: Xo Mea t+ Xz ele Draw legie “Olaryca yy epee noes Gs Voltage velhege st 23 eh AN + function y=g.ch4(nt,n2,d1) % saved in a file called g.ch4.e yror(or(and(at ,n2) ,and¢nt ,di)),and (n2,41)); and the following is a main program that generates the truth table Table= (1; for n1-0:1 for 22-0:1 for dino: gre_chf(nt n2,at); Table=(Table} [nt ,22,d1,g)1; end end end Table Write a futietion to compute the value of the following Boolean expression: P(A, BIO) = ABC + ABC + ABC + ABC Write # mnin program to generate the truth table of the funetion. Here Cis the complement of Cand int Mat aby wé-ean use ‘not{C)' 10 compute it. ‘Two vectors 1 and 1 of equal length are identical if every element in w equal t ‘Joop fashion one enn write the following function: corresponding eleaneaitit a I % voqu.m: test two vectors for being identical function t=vequ(,u) tet; fassune equal for ke1:4:Length(v) teand(t,(K)==u(k)) ; ant break end end J MatLab we ean use the fimetion “any” to check for any difference between (6 yeetors: any( su)’ rolums true if ay element ia » dows wot equal to its corresponding elesnent in 1 locate the positions of the diferent element we ean use the command "ind As fllons Tfind(oea) 2,34.5,5.7 80) nnd v=[1,3.3.8,50,7.8,9] then find(u-v) returns the vector I=[2,6] which are the positions of lerent elements in the two veetars. The command length(1) will rebirn 2 since ouly two elements are dierent jn the two vectors Nomevical hutegration of fanetions ean be conducted! using sevoral MatLab funetions sucks as “quad? and ‘qual “To integrate the function f(x) = a — 2e-+ 1 over the interval x=1 and x=8 we use: arca=quad(2.3 +224 1.1.3) which otras tie value of 30.0000. We can integrate the finction sing Monte-Carlo teehnique wih is based on random nhinbers It we sketch He function and enclose it in a neetangle of widths — x1=8-1=2 and height=max({(1)(3)). Now enevate NT say 1000 random numbers ay between 1 and 8, aud for every ratiton mumber generate aster randotn number yp between 0 and height. Count the nuraber of points where f(x.) > yp (ie. that fall below tie curve) anid call this NL, then the areas {4 seheight «width. Compare your results to what we got trom siuid (Nabe that eeory time you rin yome progam you will get. diferent answer sinew the niners ae general randomly)

You might also like