![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1245167/image.png)
Binary polynomial division (R2022b)
21 views (last 30 days)
Show older comments
I want to divide 2 binary polynomials with matlab.
As in the attached picture.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1230647/image.jpeg)
I have the following code, but unfortunately this does not work because it does not calculate binary.
g = poly2sym([1 0 1 1]);
x = poly2sym([1 0 0 0])
u1 = poly2sym([1 0 0 0])
[q,r] = deconv(sym2poly(x *u1) ,sym2poly(g))
How could I do this?
0 Comments
Answers (1)
Sai
on 28 Dec 2022
I understand that you are trying to perform Binary Polynomial Division (Modulo Division of Polynomials). To get the expected result, gfdeconv command should be used instead of deconv with some modifications in writing polynomials as shown
g = x^3 + x + 1 = 1 + x + x^3 = [1 1 0 1]
The following code snippet helps you for better understanding of using the command
g = [1 1 0 1] % g = 1 + x + x^3
gfpretty(g)
x1 = [0 0 0 1] % x1 = x^3
gfpretty(x1)
u1 = [0 0 0 1] % u1 = x^3
gfpretty(u1)
[q,r] = gfdeconv(conv(x1,u1) ,g) %q -> queotient, r -> remainder
gfpretty(q)
gfpretty(r)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1245167/image.png)
Refer to the below documentation link for more information on gfdeconv and gfpretty
Hope the query is resolved.
0 Comments
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!