MATH 267 Eigenvalues and eigenvectors in MATLAB The command >> [v,d]=eig(A) returns eigenvalues and eigenvectors of the matrix A. Here d is a matrix for which the diagonal element d(k,k) is the k’th eigenvalue of A and v is a matrix whose k’th column is an eigenvector corresponding to the k’th eigenvalue. For example to find the eigenvalues and eigenvectors of 3 2 2 A= 1 4 1 −2 −4 −1 we enter >> A=[3 2 2;1 4 1;-2 -4 -1] >> [v,d]=eig(A) to which MATLAB responds v = -0.8944 0.4472 -0.0000 0.7071 0 -0.7071 -0.0000 0.7071 -0.7071 0 1.0000 0 0 0 3.0000 d = 2.0000 0 0 So the eigenvalues are λ = 2, 1, 3 with each of the columns of v giving a corresponding eigenvector. Why the oddball numbers in v? MATLAB insists on defining v so that each column is a unit vector, i.e. the sum of the squares of the entries is always 1. The eigenvectors are thus normalized to have length p 1. For pexample, the 3rd column, corresponding to λ = 3 is really [0 1/2 − 1/2]T . However you should recognize that for the purpose of writing down the solution of y0 = Ay it would be a lot neater to use the equivalent eigenvector [0 1 − 1]T . Similarly the first two columns could be ’unnormalized’ to give [−2 1 0]T and [1 0 − 1]T . If the eigenvalues are complex, MATLAB will still return the eigenvalues and (complex) eigenvectors. Homework In 1 and 2, use the eig command as much as possible to find the general solution of the system y0 = Ay. Always try to use ’unnormalized’ eigenvectors when expressing the solution. 1. 2. 4 1 A= 1 7 1 4 10 1 1 10 4 1 7 1 1 4 1 −1 A= 5 −3 3. What does the eig command seem to do when A has repeated eigenvalues. (Suggestion: Try a couple of examples in which you know what the eigenvalues and eigenvectors should be. Be sure to consider both the possibility that the geometric multiplicity is equal or unequal to the algebraic multiplicity.) 4. Do Problem 2, page 556, parts (ii) and (iii). 5. Go to the web site math.rice.edu/∼dfield/dfpp.html and click on the PPLANE 2004.1 button. Enter the system from the previous problem in the Pplane Equation Window, then click on points in the Pplane Phase Plane Window to draw solution curves. Do this for enough points to clearly confirm your answer to the previous problem. Note that in the Equation Window you can adjust the axes limits, so that you can ’zoom in’ on each equilibrium point separately. Print out and hand in the phase plane portrait(s) you produce, along with any necessary explanations.