# deconv

Deconvolution or polynomial division

### [q, r]=deconv(b, a)

• It performs the polynomial division: $$\frac{b(x)}{a(x)}=\frac{b_nx^n+b_{n-1}x^{n-1}+\cdots+b_1x+b_0}{a_mx^{m}+a_{m-1}x^{m-1}+\cdots+a_1x+a_0}.$$
• b is a vector containing the coefficients of $b(x)$, which can be real or complex.
• a is a vector containing the coefficients of $a(x)$, which can be real or complex. The first element of a, i.e., a(1), must be non-zero.
• The outputs q and r contain the coefficients of the polynomials $q(x)$ and $r(x)$, respectively, such that $$\frac{b(x)}{a(x)}=q(x)+\frac{r(x)}{a(x)}.$$ $r(x)$ is the reminder of the division, with lower order than $a(x)$.
• When n < m, the output q is 0 and r is the same as b.

Note

When representing a polynomial by a vector p, p(1) is the highest order term coefficient.

Note

conv(a,q) + r gives the same vector as b. See conv.

Example 1: Polynomial division. The numerator has lower order, so that r is the same as the numerator u. $$\frac{u(x)}{v(x)}=\frac{x^4+2x^3+3x^2+4x+5}{x^5+2x^4+3x^3+4x^2+5x+6}.$$

u=1:5;
v=1:6;
[q,r]=deconv(u,v)

q =
0.000

r =
1.000   2.000   3.000   4.000   5.000


Example 2: Polynomial division. The numerator has higher order: $$\frac{u(x)}{v(x)}=\frac{x^6+2x^5+3x^4+4x^3+5x^2+6x+7}{x^5+2x^4+3x^3+4x^2+5x+6}=x+\frac{7}{x^5+2x^4+3x^3+4x^2+5x+6}.$$

u=1:7;
v=1:6;
[q,r]=deconv(u,v)

q =
1.000   0.000

r =
Columns 1 through 5:
0.000   0.000   0.000   0.000   0.000
Columns 6 through 7:
0.000   7.000


Example 3: Convolution conv gives back u.

u=1:7;
v=1:6;
[q,r]=deconv(u,v)
conv(v,q)+r

q =
1.000   0.000

r =
Columns 1 through 5:
0.000   0.000   0.000   0.000   0.000
Columns 6 through 7:
0.000   7.000

ans =
Columns 1 through 5:
1.000   2.000   3.000   4.000   5.000
Columns 6 through 7:
6.000   7.000