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

dpb
dpb 2019년 12월 15일
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