Leverrier method to find polynomial of matrix

1 Ansicht (letzte 30 Tage)
qUser Userq
qUser Userq am 2 Jun. 2020
Kommentiert: qUser Userq am 2 Jun. 2020
Hi guys,
I need to find a method to generalize Leverrier Method to find matrix's characteristic polynomial.
Input should be only the matrix.
As theory I have:
  1. PA(x)=x^n-c1*n^(n-1)+c2*x(n-2)+...+(-1)^n*c[n] - polynomial
  2. s[k]=trace(A^k), 1<=k<=n
  3. c[k], 1<=k<=n
c1=s1
c2=(s1*c2-s[k])/2
c[k]=(s1*c[k-1]-s2*c[k-2]+...+(-1)^(k+1)*s[k])/k, 2<=k<=n
Also i have to display PA and a graph or something
What I have so far:
function [A,n]=leverrier_n()
for i=1 to n
for j=2 to n
V[j]=A^j
s[i]=trace(V[j])
end
end
for k=2 to n
i=1;
t[1]=s[1]
t[k]=(s[i]*t[k-1]-s[i+1]*t[k-2]+)/k
end
end

Akzeptierte Antwort

David Hill
David Hill am 2 Jun. 2020
function c = leverrier(A)
a=size(A,1);
M=zeros(a);
c=zeros(1,a+1);
c(1)=1;
for k=2:a+1
M=A*M+c(k-1)*eye(a);
c(k)=-1/(k-1)*trace(A*M);
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by