3.0

3.0 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.58 KB File ID: #19565

Polynomial division by convolution - quotient and reminder

by Feng Cheng Chang

 

12 Apr 2008 (Updated 07 Jul 2011)

Division of two polynomials to get quotient and reminder using convolution matrix.

| Watch this File

File Information
Description

Polynomial division by convolution matrix approach.

Given b(x) and a(x), and find q(x) and r(x) in
    b(x) = a(x)*q(x) + r(x)
where
 b(x) = b(0)+ ... +b(k)*x^k + ... +b(n)*x^n
 a(x) = a(0)+ ... +a(k)*x^k + ... +a(m)*x^m
 q(x) = q(0)+ ...+ q(k)*x^k + ... +q(n-m)*x^(n-m)
 r(x) = r(0)+ ...+ r(k)*x^k + ... +r(m-1)*x^(m-1)

If coefficients of b(x) and a(x) are all integers, then the entire process may involve mostly integer arithmetric operations. The roundoff errors may thus be eliminated.

This code is similar to the MATLAB's built-in function: 'deconv.m'.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Calculates inverse Z-transform by long division
This submission has inspired the following:
Polynomial division - derived form covolution

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
30 Mar 2009 Krishna Prasad  
30 Mar 2009 Krishna Prasad

This programme is not working when the coefficient of the polynomial are zeros.
e.g a(x)=x^4+1
        b(x)=x^2

30 Mar 2009 Feng Cheng Chang

Krishia Prasad:
Please try it again. It should have worked perfectly for both polynomials b(x) and a(x) with trailing zeros.
For the example you gave: b(x)=x^4+1 and a(x)=x^2, yielding the desired results: q(x)=x^2 and r(x)=1.
>> b = [1 0 0 0 1]; a = [1 0 0];
>> [q,r,qc,rc,c] = PolyDiv(b,a)
  q = 1 0 0
  r = 1
  qc = 1 0 0
  rc = 0 1
  c = 1
Also it should be OK for b(x) with leading zero coefficients; however, not for a(x) with trailing zero coefficients.
>> b = [0 0 1 0 0 0 1 0]; a = [1 0 1 0 0];
>> [q,r,qc,rc,c] = PolyDiv(b,a)
 q = 1 0
 r = -1 0 1 0
 qc = 0 0 1 0
 rc = -1 0 1 0
 c = 1
Anyway I thank you for giving me this peculiar case to work with.
I will update the code involving any polynomials with both leading and trailing zero coefficients.
                    Feng Cheng Chang

27 Apr 2009 Zeeshan Shareef

Thank you...
It help me alot.

Please login to add a comment or rating.
Updates
24 Mar 2009

Correct typo in Description, and update the M-file.

30 Mar 2009

Update the m-file, to include any polynomials with both leading and trailing zero coefficients.

07 Jul 2011

update the m file

Tag Activity for this File
Tag Applied By Date/Time
linear algebra Feng Cheng Chang 22 Oct 2008 09:57:39
polynomial division Feng Cheng Chang 22 Oct 2008 09:57:39
synthetic division Feng Cheng Chang 22 Oct 2008 09:57:39
longhand division Feng Cheng Chang 22 Oct 2008 09:57:39
polynomial division MUSTAFA ?SMA?L ALKAN 09 Oct 2011 05:46:21

Contact us at files@mathworks.com