Having trouble plotting a specific function

40 Views Asked by At

let $$A = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 5 & 6 \\ 4 & 8 & 9 \\ \end{pmatrix}$$

I want to plot this function $\lambda\to||(\lambda I_3-A)^{-1}||$

and then point out the eigen values on the graph

My try : since $\sum\lambda = Tr(A) = 15$ and $\prod\lambda = det(A) = -3 $

I chose this interval $x= -20:0.1:20$ all the eigenvalues sould be within that interval

then tried this : plot(x,norm((x.*B-A)^(-1))) where B =eye(3). but an error popped.

Please I need some help.

Thank you.

1

There are 1 best solutions below

0
On

When $\lambda$ is an eigenvalue of $A$ the matrix $\lambda I-A$ becomes singular (for any $A$). Thus, the inverse of this matrix does not exist at these points. In practice, when $\lambda$ is near a eigenvalue, the inverse "blows up". Thus, the Matlab gives an error.

If you just plot the determinant of $(x I -A)$, you will notice the eigenvalues when the shifted matrix becomes zero. Since, you have access to Matlab, it is rather easy to compute the eigenvalues of $A$ to confirm your observations.

Warning: Numerical analysts normally do not like to compute determinants. Perhaps, you should also compute the smallest singular value (using the svd in Matlab) and visualise the two plots.