Polynomial division - quotients Q and remainder R

5 Ansichten (letzte 30 Tage)
Thorm
Thorm am 30 Mär. 2021
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?

Antworten (1)

Pratheek Punchathody
Pratheek Punchathody am 6 Apr. 2021
Bearbeitet: Pratheek Punchathody am 6 Apr. 2021
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

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by