Polynomial division - quotients Q and remainder R
9 次查看(过去 30 天)
显示 更早的评论
I want to divide two polynomials (numerator and denominator). The result should be displayed as quotients Q and remainder R. Like here:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567299/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567304/image.png)
Result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567309/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567314/image.png)
Matlab code
clear all;
close all;
clc;
syms x
I_sym = x^7 + x^3 + x^2 + x;
G_sym = x^4 + x^3 + x^2 + 1;
xK_sym = x^4;
%% Convert to polynomial
I_pol = sym2poly(I_sym);
G_pol = sym2poly(G_sym);
xK_pol = sym2poly(xK_sym);
Numerator = conv(xK_pol, I_pol);
Denominator = G_pol;
[Q, R] = deconv(Numerator, Denominator)
The result looks like this:
Q =
1 -1 0 1 -1 2 0 -3
R =
0 0 0 0 0 0 0 0 4 1 0 3
This is not the expected result. What have I done wrong?
0 个评论
回答(1 个)
Pratheek Punchathody
2021-4-6
编辑:Pratheek Punchathody
2021-4-6
Looks like you have obtained the right quotient and remainder for the above two polynomials. Even using the direct co-efficients of the polyomials with the "deconv" function, the mentioned results are obtained.
u = [1 0 0 0 1 1 1 0 0 0 0 0];
v = [1 1 1 0 1];
[q,r] = deconv(u,v);
Results:
q =
1 -1 0 1 -1 2 0 -3
r =
0 0 0 0 0 0 0 0 4 1 0 3
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!