Polynomial division - quotients Q and remainder R

8 ビュー (過去 30 日間)
Thorm
Thorm 2021 年 3 月 30 日
編集済み: Pratheek Punchathody 2021 年 4 月 6 日
I want to divide two polynomials (numerator and denominator). The result should be displayed as quotients Q and remainder R. Like here:
Result:
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?

回答 (1 件)

Pratheek Punchathody
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

Community Treasure Hunt

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

Start Hunting!

Translated by