Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
A Simple Characteristic Polynomial Routine

Subject: A Simple Characteristic Polynomial Routine

From: Jeff

Date: 13 Aug, 2010 18:50:25

Message: 1 of 5

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

Subject: A Simple Characteristic Polynomial Routine

From: Matt J

Date: 13 Aug, 2010 19:10:29

Message: 2 of 5

"Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <i4445h$mbp$1@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().

Subject: A Simple Characteristic Polynomial Routine

From: Jeff

Date: 13 Aug, 2010 21:04:04

Message: 3 of 5

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <i445b5$7hj$1@fred.mathworks.com>...
> "Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <i4445h$mbp$1@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.

Subject: A Simple Characteristic Polynomial Routine

From: Matt J

Date: 13 Aug, 2010 21:16:05

Message: 4 of 5

"Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <i44c04$7b8$1@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...

Subject: A Simple Characteristic Polynomial Routine

From: Jeff

Date: 13 Aug, 2010 22:00:24

Message: 5 of 5

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <i44cml$k4e$1@fred.mathworks.com>...
> "Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <i44c04$7b8$1@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.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us