Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
1250 Homework Matlab® 3, 4 F 14 1. Use MATLAB to solve for x in the following quadratic equation: x 2 + 2x -15 = 0 Recall the formula for the quadratic equation solution: x= -b ± b 2 - 4ac 2a or, when a =1 (the coefficient of the x2 term), we have a simpler form: 2 b æ bö x=- ± ç ÷ -c è 2ø 2 2. Use MATLAB to evaluate the following formula for = 8: y = log10 jw 3. 1 3 + j4 MATLAB can generate random numbers that look like the noise observed in all electrical signals and heard in musical recordings, as the following steps demonstrate. a) Use the randn() function in MATLAB to create a 2000 by 1 vector, x, of noise samples. b) Use the sound() function in MATLAB to listen to the vector, x, of noise samples. Describe the sound you hear. Remember that you can write Matlab® statements that are comments if you start with a % symbol. c) 4. Use the plot() function in MATLAB to see your waveform of noise samples, x. Describe the pattern of the waveform in your own words. The following circuit has the Kirchhoff's equations listed below it: -6V + i2 ×1kW + i3 × 750 W = 0V i3 = i1 i3 - i2 - 0.25i1 = 0 A MATLAB can solve these equations if we transform them into a matrix equation. The first step is to write the equations in the following form with i's on the left and constant voltages, V's (not to be confused with v2 or v3), on the right: é R11 R12 ê i1R21 + i2 R22 + i3 R23 = V2 or ê R21 R22 ê R i1R31 + i2 R32 + i3 R33 = V3 R32 ë 31 i1R11 + i2 R12 + i3R13 = V1 R13 ù é úê R23 ú ê R33 ú ê ûë i1 ù é V1 ù ú ê ú i2 ú = ê V2 ú i3 ú ê V3 ú û ë û Recall that the product of matrices (and vectors are just matrices with only one row or column) is calculated by taking a dot product of the rows of the left matrix with the column(s) of the right matrix. For this problem, we have the following equations from which we can identify R's and V's: 0W ×i1 +1kW ×i2 + 750 W × -i3 = 6V ( -1×i1 + 0 ×i2 +1×i3 = 0 A) ×1W ( -0.25 ×i1 -1×i2 +1×i3 = 0 A) ×1W We have the following matrix equation. é é 0W 1kW 750W ù ê ê ú 0W 1W ú ê ê -1W êë -0.25W -1W 1W úû ê ë i1 ù é 6V ù ú ê ú i2 ú = ê 0V ú i3 ú ê 0V ú û ë û Now we are ready to use MATLAB. a) Create a matrix (call it what you like) in MATLAB containing the values of the R's, (i.e., create the matrix on the left). b) Create a vector (call it what you like) in MATLAB containing the values of the V's, (i.e., create the vertical vector on the right). c) Use the inv() function in MATLAB to invert the matrix of R's, and then multiply the result by the vector of V's to get the vector of i's. Verify that you get the following answer: i1 = 4 mA, i2 = 3mA, i3 = 4 mA 5. (Reprieve of a problem from an earlier homework.) The curve below shows the voltage across an incandescent light-bulb versus time. The current through the bulb has the same shape. The functions for the voltage and current are 4 v(t) = 150 cos(2p (60)t) V and i(t) = cos(2p (60)t) A. 3 Use MATLAB to create a plot of the power versus time as follows: a) Create a vector of time, t, containing values from 0 to 1/60 of a second, spaced by 1/6000 of a second. b) Compute a vector for v(t) and a vector for i(t) by applying the cos() function to vector t. Use names of your choice for v(t) and i(t) in MATLAB. c) Use the .* operator in MATLAB to compute the power p(t), which is the product of i(t) and v(t). Use the name p for the vector containing p(t). d) Use plot(t,p) to plot the waveform of the power versus time.