📄 gcdpoly.m
字号:
function z=gcdpoly(x,y)
% function z=gcdpoly(x,y)
% This function find the great common divisor of the two polynomial x and y
root_x=roots(x);
root_y=roots(y);
z=1;
[test,root_x,root_y]=reduce(z,root_x,root_y);
while length(test)>1
z=conv(z,test);
[test,root_x,root_y]=reduce(z,root_x,root_y);
end
z=z/z(end);
function [z,root_x,root_y]=reduce(z,root_x,root_y)
for i=1:length(root_x)
for j=1:length(root_y)
if root_x(i)==root_y(j)
z=poly(root_x(i));
root_x(i)=[];
root_y(j)=[];
return
end
end
end
z=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -