{"id":371,"date":"2017-09-14T12:00:13","date_gmt":"2017-09-14T15:00:13","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=371"},"modified":"2017-09-14T12:00:13","modified_gmt":"2017-09-14T15:00:13","slug":"eigen2-m","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/eigen2-m\/","title":{"rendered":"eigen2.m"},"content":{"rendered":"<pre>function eigen2(A)\r\n\r\n% eigen2  Characteristic polynomial, eigenvalues, eigenvectors \r\n% of a 2 by 2 matrix.\r\n%\r\n% eigen2(A) prints the characteristic polynomial det(A-e*I),\r\n% eigenvalues, and eigenvectors of A. \r\n%\r\n% If A is not diagonalizable, its single eigenvector is \r\n% printed twice.\r\n\r\nd = A(1,1)*A(2,2) - A(1,2)*A(2,1);\r\nt = A(1,1) + A(2,2);\r\ne1 = (t + sqrt(t^2 - 4*d))\/2;\r\ne2 = (t - sqrt(t^2 - 4*d))\/2;\r\nif A(1,2) ~= 0\r\n   x1 = [A(1,2); e1-A(1,1)];\r\n   x2 = [A(1,2); e2-A(1,1)];\r\nelseif A(2,1) ~= 0\r\n   x1 = [e1-A(2,2); A(2,1)];\r\n   x2 = [e2-A(2,2); A(2,1)];\r\nelse\r\n   x1 = [1; 0];\r\n   x2 = [0; 1];\r\nend\r\n\r\ndisp(' ')\r\ndisp('For this matrix, the polynomial whose roots are the eigenvalues is:')\r\ndisp(['   e^2 - ' num2str(t) '*e + ' num2str(d) ' = 0'])\r\n\r\ndisp(' ')\r\ndisp('The first eigenvalue and eigenvector are:')\r\ne1\r\nx1\r\n\r\ndisp(' ')\r\ndisp('The second eigenvalue and eigenvector are:')\r\ne2\r\nx2<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function eigen2(A) % eigen2 Characteristic polynomial, eigenvalues, eigenvectors % of a 2 by 2 matrix. % % eigen2(A) prints the characteristic polynomial det(A-e*I), % eigenvalues, and eigenvectors of A. % % If A is not diagonalizable, its single eigenvector is % printed twice. d = A(1,1)*A(2,2) &#8211; A(1,2)*A(2,1); t = A(1,1) + A(2,2); e1 = [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-371","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=371"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/371\/revisions"}],"predecessor-version":[{"id":372,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/371\/revisions\/372"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}