Polynomial division - quotients Q and remainder R

4 visualizzazioni (ultimi 30 giorni)
Thorm
Thorm il 30 Mar 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?

Risposte (1)

Pratheek Punchathody
Pratheek Punchathody il 6 Apr 2021
Modificato: Pratheek Punchathody il 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

Community Treasure Hunt

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

Start Hunting!

Translated by