Chapter Matlab Exercses Chapter Matlab Exercses. Consder the lnear system of Example n Secton.. x x x y z y y z (a) Use the MATLAB command rref to solve the system. (b) Let A be the coeffcent matrx and B be the rght-hand sde of the system. A ] B ] Use the Matlab command A\B to solve the system.. Enter the matrx A ]. Use the Matlab command rref to fnd the reduced row-echelon form of A. What s the soluton of the lnear system represented by the augmented matrx A?. Use the MATLAB command A\B to solve the lnear system x x x x y y y 8y z z 8z z w 8w w 8w 8. You can dsplay more sgnfcant dgts of the answer by enterng format long before solvng the system. Return to the standard format by enterng format short.. Use the Matlab command rref to determne whch of the matrces below are row-equvalent to B (a) 8 ]. ] (b) 8 ] (c) 8. Let A be the coeffcent matrx and B the rght-hand sde of the lnear system x x x x y y y y z z z 8z 8. Enter the matrces A and B, and form the augmented matrx C for ths system by usng the Matlab command C A B]. Solve the system usng rref.. The Matlab command polyft allows you to ft a polynomal of degree n to a set of n data ponts n the plane (x, y ), (x, y ),..., (x n, y n ). Fnd a fourth-degree polynomal that fts the fve data ponts of Example n Secton. by lettng x ] y ] and enterng the MATLAB command polyft(x, y, ). ]
Chapter Systems of Lnear Equatons. Use MATLAB to fnd a second-degree polynomal that fts the ponts (, ), (, ), (, ). 8. Use MATLAB to fnd a sxth-degree polynomal that fts the ponts (, ), (,.), (, ), (,.), (,.), (, ), (,.). The table below gves the revenues y (n bllons of dollars) for General Dynamcs Corporaton from through. (Source: General Dynamcs Corporaton) Year Revenue, y..... Use p polyft(x, y, ) to ft a fourth-degree polynomal to the data. Let x represent the year, wth x correspondng to. Then use f polyval(p, ) to estmate the revenue n. (The actual revenue n was $. bllon). Is a fourth-degree polynomal a good ft for the data? Explan.
Chapter Matlab Exercses Chapter Matlab Exercses. Enter the matrces A ] and B Use MATLAB to fnd (a) A B (b) B A (c) AB (d) BA.. Enter the matrces A B.... C ].... 8.... 8....] 8 8]. ]. (a) Enter format long and then fnd A B. Return to the standard short format wth format short. (b) Fnd AC and BC. Defne what s meant by the nverse of a square matrx. What s the nverse of the matrx A? of the matrx C?. Wrte the system of lnear equatons below n the form AX B and use the matlab command A\B to solve the system. x x x y y y z z z Check your answer usng rref.. Enter the matrces A ] and B pascal(). (a) Use the matlab command trace to fnd the traces of A, B, and A B. What do you observe? (b) What s the relatonshp between the trace of AB and the trace of BA?. Use the matlab command dag to form the dagonal matrx D wth dagonal entres,,,, and. Fnd the product D DDDD. When D s an n n dagonal matrx, descrbe how to fnd the product D k for any postve nteger k.. Enter the matrces A (a) Fnd AB AC ] ] 8 B C and A(B C). What do you observe? (b) Fnd (AC), A(C), and (A)C. What do you observe?. Let ]. A Use MATLAB to fnd A, A, and A 8. Descrbe the matrx A n for large n. 8 8].
Chapter matrces 8. Enter the matrces A ] A zeros(, ) A (a) Form the matrx A usng the matlab constructon A A A; A A]. (b) Fnd the smallest value of n, where n s a postve nteger, such that A n A.. Use the matlab command nv to fnd the nverse of the matrx A below. Then adjon the dentty matrx I eye() to A to form the matrx B A I]. Row-reduce B to fnd the nverse of A agan. What do you observe? A ]. Let A and B be the matrces below. ] ] A B (a) Use MATLAB to fnd A B, (AB), and (BA). What do you observe? (b) Use MATLAB to fnd (A ) T and (A T ). What do you observe? Remember: The command for the transpose of a real matrx A s A.. In ths exercse, you wll use matlab to fnd the least squares regresson lne for the set of data (, ), (, ), (, ), (, ), and (, ) from Example n Secton.. (a) Form the matrces below. X ] Y ] (b) Let A (X T X) X T Y. (c) Compare your answer wth the matlab least squares command polyft. Hnt: Let X X(:, ) and enter polyft(x, Y, ). (d) Plot the data usng the matlab commands below. t (:.: ); plot(x, Y, '') (e) Plot the least squares lne for the data by usng the Matlab commands below. t (:.: ); ppolyft(x, Y, ); fpolyval(p, t); plot(t, f, * ) (f) You can combne the plots n parts (d) and (e) by usng the Matlab command plot(x, Y,, t, f, * ).. Repeat Exercse for the data (, ), (, ), (, ), (, ), (, ). Plot the data and the least squares lne on the nterval, ]. That s, use t (:.: );. ].
Chapter Matlab Exercses Chapter Matlab Exercses. Use Matlab to fnd the determnant of each matrx. (a) (c) pascal(). Let A ] (b) ]. (d) hllb(8) ] (a) Evaluate det( * eye() A). (b) Fnd an nteger value of t such that det(ti A).. Choose arbtrary matrces A and B. Use MATLAB to fnd det(a) det(b) and det(ab). What do you observe? Do the same for det(a) det(b) and det(a B).. Choose an arbtrary real number t. Form the matrx A cos(t) sn(t) sn(t) cos(t)] and use MATLAB to evaluate ts determnant. Does the value of the determnant depend on t?. Consder the matrces A ] and B Use MATLAB to verfy each statement. (a) det(a) det(b) det(ab) (b) det(a T ) det(a) (c) det(a ) det(a). ths exercse uses Cramer s Rule to solve the lnear system Ax b from Example n Secton.. Let A ] and b ] be the coeffcent matrx and the rght-hand sde, respectvely, of the system. To form the matrx A, replace the frst column of A wth b. To do ths, enter the commands below. A A A(:, ]) b Obtan x by enterng det(a) det(a). Obtan x n a smlar manner. A A A(:, ]) b det(a) det(a). Use the Cramer s Rule algorthm from Exercse to solve the lnear system below. Compare your answer wth that obtaned usng rref. x x x y y y z z z ].
Chapter Matlab Exercses Chapter Matlab Exercses. Let u (,,, ), u (,,, ), and u (,,, ). Use matlab to wrte (f possble) the vector v as a lnear combnaton of the vectors u, u, and u. (a) v (,,, ) (b) v (,,, ). Use Matlab to determne whether the gven set of vectors spans R. (a) {(,,, ), (,,, ), (,,, ), (,,, )} (b) {(,,, ), (,,, ), (,,, ), (,,, )}. Use Matlab to determne whether the set s lnearly ndependent or dependent. (a) {(,,, ), (,,, ), (,,, ), (,,, )} (b) {(,,,, ), (,,,, ), (,,,, ), (,,,, ), (,,,, )}. Use Matlab to determne whether the set of vectors forms a bass of R. (a) {(,,, ), (,,, ), (,,, ), (,,, )} (b) {(,,, ), (,,, ), (,,, ), (,,, )} (c) {(,,, ), (,,, ), (,,, ), (,,, )} (d) {(,,, ), (,,, ), (,,, ), (,,, ), (,,, )}. One way to fnd a bass for R that contans the vectors v (,,, ) and v (,,, ) s to consder the set of vectors consstng of v and v, together wth the standard bass vectors, e (,,, ), e (,,, ), e (,,, ), and e (,,, ). Let A be the matrx whose columns consst of the vectors v, v, e, e, e, and e, and apply rref to A to obtan A ] The leadng ones of the reduced matrx on the rght are n columns,,, and, so a bass for R conssts of the correspondng column vectors of A: {v, v, e, e }. a convenent way to construct the matrx A s to defne the matrx B whose columns are the gven vectors v and v. Then A s the matrx obtaned by adjonng the dentty matrx to B: A B eye()]. Use ths algorthm to fnd a bass for R that contans the vectors. (a) v (,,,, ), v (,,,, ) (b) v (,,,, ), v (,,,, ), v (,,,, ). Use Matlab to fnd a subset of the set of vectors that forms a bass for the span of the vectors. (a) {(,,, ), (,,, ), (,,, ), (,,, )} (b) {(,,,, ), (,,,, ), (,,,, ), (,,,, ), (,,,, ), (,,,, )}. Let A ] (a) Use MATLAB to fnd a bass for the row space of A. (b) Use MATLAB to fnd a bass for the column space of A. (c) Use the matlab command rank to fnd the rank of A. ].
Chapter vector spaces 8. Fnd a bass for the nullspace of each matrx A. Then verfy that the sum of the rank and nullty of A equals the number of columns. (a) A 8 ] (b) A hlb() (c) A pascal() (d) A magc(). Let {(,, ), (,, ), (,, )} be a (nonstandard) bass for R. You can fnd the coordnate matrx of x (,, ) relatve to ths bass by wrtng x as a lnear combnaton of the bass vectors. That s, the coordnate matrx s the soluton vector of the lnear system Bc x, where the bass vectors form the columns of B. Use MATlab to solve ths system and compare your answer to that of Example n Secton... Let B {(,, ), (,, ), (,, )} and BPRIME {(,, ), (,, ), (,, )} be the two bases of R n Example n Secton.. You can use matlab to fnd the transton matrx from B to BPRIME by frst formng the two matrces B ] and BPRIME ] Aadjon B and BPRIME by usng the matlab command C BPRIME B]. Let A be the reduced row-echelon form of C, A rref(c). Fnally, obtan PINV P by deletng the frst three columns of ths reduced matrx usng the matlab command PINV A(:, :). Fnd the transton matrx from B to BPRIME. (a) B {(, ), (, )} BPRIME {(, ), (, )} (b) B {(,,, ), (,,, ), (,,, ), (,,, )}, BPRIME {(,,, ), (,,, ), (,,, ), (,,, )}
Chapter Matlab Exercses Chapter Matlab Exercses. Use the MATLAB command norm(v) to fnd (a) the length of the vector v (,,,, ). (b) a unt vector n the drecton of v (,,,,, ). (c) the dstance between the vectors u (,,, ) and v (,,, ).. The dot product of the vectors (wrtten as columns) u u u un] and v v v vn] can be found usng the matrx product u v u T v u u... u n ]v v vn]. So, you can compute the dot product of u and v by multplyng the transpose of the vector u by the vector v. Let u (,,,, 8), v (,,,, ), and w (,,,, ), and use MATLAB to fnd each quantty. (a) u v (b) (u v)w (c) u (v w) (d) v v. The angle θ between two nonzero vectors can be found usng cos θ u v u v. Use MATLAB to fnd the angle between u (,, ) and v (,, ). (Hnt: Use the bult-n nverse cosne functon, acos.). You can fnd the orthogonal projecton of the column vector x onto the column vector y by evaluatng x T y y T y y. Use MATLAB to fnd each projecton of x onto y. (a) x (,, ), y (,, ) (b) x (,, ), y (,, ) (c) x (,,, ), y (,,, ). Use the MATLAB command cross(u, v) to fnd each cross product. (a) u (,, ), v (,, ) (b) u (,, ), v (,, ). Let u (,, ), v (,, ), and w (,, ). Use MATLAB to llustrate each property of the cross product lsted below. (a) u v (v u) (b) u u (c) u (v w) (u v) (u w) (d) u (v w) (u v) w
Chapter nner product spaces. The MATLAB command A\b fnds the least squares soluton of the lnear system of equatons Ax b. For example, f A ] and b ], then the command A\b gves..]. Use MATLAB to solve each least squares problem Ax b. (a) A (b) A (c) A ] b ] b ] ] b ] ] 8. Use MATLAB to fnd bases for the four fundamental subspaces of each matrx. (a) (c) ] (b) ] (d) ] ]
Chapter Matlab Exercses Chapter Matlab Exercses. Use MATLAB to fnd the kernel and range of the lnear transformaton defned by T(x) Ax for each matrx A. (a) A (b) A ] ] (c) A (d) A 8 ] ]. Let B be the upper tranglular matrx generated by the MATLAB command B tru(ones()). Let A BB T B and determne the rank and nullty of the lnear transformaton L: R R, L(x) Ax.. Use MATLAB to determne whch of the lnear transformatons defned by T(x) Ax are one-to-one and whch are onto. (a) A magc() (b) A hlb() (c) A trl(ones()). Let T: R n R m be a lnear transformaton. Let B {v, v,..., v n } and BPRIME {w, w,..., w m } be bases for R n and R m, respectvely. You can use MATLAB to fnd the matrx of T relatve to the bases B and BPRIME as outlned below. (a) Form the matrces B and BPRIME whose columns are the gven bass vectors. (b) Let A be the m n standard matrx of T. (c) Adjon BPRIME to AB to form the m (m n) matrx C: C BPRIME A B]. (d) Use rref(c) to fnd the reduced row-echelon form of C. The m n matrx composed of the rght-hand n columns of the reduced row-echelon form of C form the matrx of T relatve to the bases B and BPRIME. Use ths algorthm to fnd the matrx of each lnear transformaton relatve to the bases B and BPRIME. (a) T: R R, T(x, y) (x y, y, x), B {(, ), (, )}, BPRIME {(,, ), (,, ), (,, )} (b) T: R R, T(x, y, z) (x z, y x), B {(,, ), (,, ), (,, )}, BPRIME {(, ), (, )} (c) T: R R, T(x, y, z) (x, x y, y z, x z), B {(,, ), (,, ), (,, )}, BPRIME {(,,, ), (,,, ), (,,, ), (,,, )}. Use the results of Exercse to fnd the mage of each vector v two ways: frst by fndng T(v) Av, and second by usng the matrx of T relatve to the bases B and BPRIME. (a) v (, ) (b) v (,, ) (c) v (,, ). Let B {e, e,..., e n } and BPRIME {w, w,..., w n } be two ordered bases for R n. Recall from Secton. that you can fnd the transton matrx P from B to BPRIME as outlne below. (a) Form the matrces B and BPRIME whose columns are the bass vectors. (b) Adjon B to BPRIME, formng the n n matrx C: C BPRIME B]. (c) Let D be the reduced row-echelon form of C: D rref(c). (d) P s the n n matrx consstng of the rght-hand n columns of D. Use MATLAB to fnd the matrx APRIME for the lnear transformaton T: R n R n relatve to the bass BPRIME. (a) T: R R, T(x, y) (x y, y x) BPRIME {(, ), (, )} (b) T: R R, T(x, y, z) (x, x y, x y z), BPRIME {(,, ), (,, ), (,, )}
Chapter lnear transformatons. Let B {(,, ), (,, ), (,, )} and BPRIME {(,, ), (,, ), (,, )} be bases for R, and let A ] be the matrx of T: R R relatve to B, the standard bass. Use MATLAB to answer parts (a) (e) below. (a) Fnd the transton matrx P from BPRIME to B. (b) Fnd the transton matrx P from B to BPRIME. (c) Fnd APRIME, the matrx for T relatve to BPRIME. (d) Let v] BPRIME ] and fnd v] B and T(v)] B. (e) Fnd T(v)] BPRIME two ways: frst as P T(v)] B and then as APRIMEv] BPRIME.
Chapter Matlab Exercses Chapter Matlab Exercses. The MATLAB command poly(a) produces the coeffcents of the characterstc polynomal of the square matrx A, begnnng wth the hghest degree term. Fnd the characterstc polynomal of each matrx. (a) A (b) A (c) A ] ] 8 ]. If you set p poly(a), then the command roots(p) determnes the roots of the characterstc polynomal of the matrx A. Use these commands to fnd the egenvalues of the matrces n Exercse.. The matlab command V D] eg(a) produces a dagonal matrx D contanng the egenvalues of A on the dagonal and a matrx V whose columns are the correspondng egenvectors. Use ths command to fnd the egenvalues and correspondng egenvectors of the three matrces n Exercse.. Let A ]. Use matlab to fnd the egenvalues and correspondng egenvectors of A, A T, and A. What do you observe?. Let A ]. Use matlab to dagonalze A. Frst, compute the egenvalues and egenvectors of A usng the command P D] eg(a). The dagonal matrx D contans the egenvalues of A, and the correspondng egenvectors form the columns of P. Verfy that P dagonalzes A by showng that P AP D.. Follow the procedure outlned n Exercse to show that the matrx A ] s not dagonalzable.. Follow the procedure outlned n Exercse to dagonalze (f possble) each matrx. (a) A (b) A (c) A ] ] 8 ]
Chapter Egenvalues and egenvectors 8. For a symmetrc matrx A, the matlab command P D] eg(a) produces a dagonal matrx D contanng the egenvalues of A and an orthogonal matrx P contanng the correspondng egenvectors. For example, usng the matrx A from Example 8 n Secton., A ] and the command P D] eg(a), yelds P.8...8] and D whch s equvalent to the soluton n the text. Use ths procedure to orthogonally dagonalze each symmetrc matrx. (a) A (b) A ] ] ],
Chapter 8 Matlab Exercses 8 Chapter 8 Matlab Exercses MATLAB handles complex numbers and matrces n much the same way that t handles real numbers and matrces. The magnary unt s a bult-n constant.. Verfy the result of Example n Secton 8. by enterng the matrx A, A ; ] and then enterng nv(a).. In MATLAB, A. desgnates the transpose A T of a complex matrx A. If you do not nclude the perod, then MATLAB returns the conjugate transpose A*. Use MATLAB to verfy each statement usng the matrx A from Example n Secton 8.. (a) A. ] (b) A ]. Use MATLAB to perform the matrx operatons below, where A ], B ], and C ]. (a) AB (b) C (c) A (d) C T C (e) det(a B) (f) AB ( )CC T. Use MATLAB to solve each system of lnear equatons Ax b. (a) A ], b ] (b) A ], b ]. Use MATLAB to determne whch of the matrces below are Hermtan and whch are normal. (a) (c) ] (b) ] (b) ] ]. The MATLAB command P D] eg(a) produces a dagonal matrx D contanng the egenvalues of the complex matrx A, and a matrx P contanng the correspondng egenvectors. For example, usng the matrx A from Example n Secton 8., A ] and the command P D] eg(a), yelds.8. P..8.. and D...8..8..8..],..8...88.] whch s equvalent to the soluton gven n the text. Use ths procedure to dagonalze each matrx. Verfy that P dagonalzes A by showng that P AP D. (a) A ] (b) A ] (c) ]