From: Jeff on
To check my linear algebra homework, I have been using the same routine to create the characteristic polynomial over and over again. I do not see a characteristic polynomial routine in the help (lookfor characteristic, lookfor polynomial, etc.) nor do I find one in File Exchange. Maybe this will be useful:

function pA=charPoly(A)
syms t;
[m,n]=size(A);
if m==n,
B=A-t*eye(m);
else
pA='';
return;
end
p_A=det(B);
pA=simplify(p_A);
end

HTH
-J
From: Matt J on
"Jeff " <spREMOVEHITSjeffAT(a)SIGNoptonline.net> wrote in message <i4445h$mbp$1(a)fred.mathworks.com>...
> To check my linear algebra homework, I have been using the same routine to create the characteristic polynomial over and over again. I do not see a characteristic polynomial routine in the help (lookfor characteristic, lookfor polynomial, etc.) nor do I find one in File Exchange.
========

Understandable, but the native MATLAB function poly(A) does compute the characteristic polynomial of the matrix A.

In future, you may have better luck with docsearch() rather than lookfor().
From: Jeff on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i445b5$7hj$1(a)fred.mathworks.com>...
> "Jeff " <spREMOVEHITSjeffAT(a)SIGNoptonline.net> wrote in message <i4445h$mbp$1(a)fred.mathworks.com>...
> > To check my linear algebra homework, I have been using the same routine to create the characteristic polynomial over and over again. I do not see a characteristic polynomial routine in the help (lookfor characteristic, lookfor polynomial, etc.) nor do I find one in File Exchange.
> ========
>
> Understandable, but the native MATLAB function poly(A) does compute the characteristic polynomial of the matrix A.
>
> In future, you may have better luck with docsearch() rather than lookfor().

Oops. Sorry for the forum clutter, everyone. (I am consoled because I find my routine better).
Thanks for the 'docsearch' tip. I hadn't hard of it.
From: Matt J on
"Jeff " <spREMOVEHITSjeffAT(a)SIGNoptonline.net> wrote in message <i44c04$7b8$1(a)fred.mathworks.com>...

> Oops. Sorry for the forum clutter, everyone. (I am consoled because I find my routine better).
=======

It would be interesting to know why. In any case, whatever superiority you are seeing, it comes at a price: it requires the Symbolic Toolbox, which not everyone has...
From: Jeff on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i44cml$k4e$1(a)fred.mathworks.com>...
> "Jeff " <spREMOVEHITSjeffAT(a)SIGNoptonline.net> wrote in message <i44c04$7b8$1(a)fred.mathworks.com>...
>
> > Oops. Sorry for the forum clutter, everyone. (I am consoled because I find my routine better).
> =======
>
> It would be interesting to know why. In any case, whatever superiority you are seeing, it comes at a price: it requires the Symbolic Toolbox, which not everyone has...

I liked it better because it used the symbolic toolbox and displayed the polynomial as a polynomial and also because it factored the polynomial, whereas poly() left it distributed. Of course, I guess you could just use roots(poly(MATRIX)) to eliminate the second issue.