Using functions for polynomials

Hello guys,
Im having trouble solving task 6 which is in the pdf file that I have shared.
This is what I have tried so far, but it's showing error message. I don't know how to carry on from this.
function ret=poly_fact(P1,P2)
a=size(P1)
b=size(P2)
orderP1=a(2)-1
orderP2=b(2)-1
for n=1:a(2)-1
if orderP1==orderP2 | orderP1>orderP2
if P1(1)==P2(1)
for n=1:(a(2)-b(2))
y=[0]
P2=horzcat(P2,y)
end
P1=P1-P2
else
d=P1(1)/P2(1)
P2=P2*d
end
else
disp('The order of P1 must be at least as high as the order of P2')
end
end
Can anyone help me with task 6.
Thank you.

1 个评论

Well, you could show us what inputs you used and the error message for starters...

回答(0 个)

此问题已关闭。

提问:

2019-12-15

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by