Code covered by the BSD License  

Highlights from
Polynomial roots tracker

image thumbnail
from Polynomial roots tracker by Emanuele Natale
This package allows to see how the roots continuously change from a polynomial to another.

pertpoly(P1,P2,T)
%author: Emanuele Natale
%email: natema89@gmail.com
%date: 6 febrary 2011
%Version number: 1.0

%Programma che traccia il grafico delle traiettorie sul piano complesso
%delle radici del polynomio tP1+(1-t)P2 al variari di t tra 0 e 1

%(Il parametro T in imput definisce la finezza del calcolo della
%traiettoria)
function pertpoly(P1,P2,T)

%Grafichiamo la traiettoria delle radici, segnando con 'ro'
%le redici di P1 e con '+' le radici di P2

polroots=roots(P1);
    plot(real(polroots),imag(polroots),'ro','MarkerSize',12);
    hold on;

    h=1/T;
for k=0:h:(1-h)
    
    polroots=roots((1-k)*P1+k*P2);
     plot(real(polroots),imag(polroots),'c*','MarkerSize',3);
    hold on;
end

polroots=roots(P2);
graph=plot(real(polroots),imag(polroots),'b+','MarkerSize',12);

legend(graph,'Final roots');
grid;
hold off;
axis vis3d;
end

Contact us