function polynomy
close all % zavre vsechna graf. okna
p=[2,-3,6,-2,1,-10];
disp(p)
xp=roots(p);
disp('Koreny polynomu p')
disp(xp)
q=[3,0,0,-2,0];
disp(q)
xq=roots(q);
disp('Koreny polynomu q')
disp(xq)
subplot(2,2,1)
plot(xp,'r*')
xlabel('Re')
ylabel('Im')
grid
title('Reseni 2x^5-3x^4+6x^3-2x^2+x-10')
subplot(2,2,3)
compass(xp,'g')
subplot(2,2,2)
plot(xq,'bp')
xlabel('Re')
ylabel('Im')
grid
title('Reseni 3x^4-2x')
subplot(2,2,4)
compass(xq,'c')
figure % nove graf. okno
x=linspace(-5,5,1000);
disp('Polynom p pro x=5')
disp(polyval(p,5))
disp('Polynom p pro x=-5')
disp(polyval(p,-5))
disp('Polynom p pro x=0')
disp(polyval(p,0))
disp('Polynom p pro x=-5 az 5')
disp(polyval(p,[-5:5]))
y=polyval(p,x);
subplot(2,1,1)
plot(x,y)
xlabel('x')
ylabel('hodnoty polynomu p')
y2=polyval(q,x);
subplot(2,1,2)
plot(x,y2)
xlabel('x')
ylabel('hodnoty polynomu q')
disp('Nasobeni polynomu')
s=conv(p,q);
disp(s)
disp(length(s))
disp('Deleni polynomu')
[v,z]=deconv(s,q);
disp('Vysledek')
disp(v)
disp('Zbytek')
disp(z)
end

