Borrar filtros
Borrar filtros

Multiplying two polynomials without using conv() function

6 visualizaciones (últimos 30 días)
gmltn1212
gmltn1212 el 13 de Jun. de 2020
Editada: Saleh AlSenaidi el 27 de Nov. de 2021
How can I multiply two polynomials without usiing conv() function?
%two polynomials
a = [13,-13] %a = 13x - 13
b = [-13,9,8] %b = -13x^2 + 9x + 8
I am trying to return the result of the mutiplication like this
m = [-169, 286, -117, -104]

Respuestas (2)

Ameer Hamza
Ameer Hamza el 13 de Jun. de 2020
Editada: Ameer Hamza el 13 de Jun. de 2020
"without using conv() function"
syms s
a = [13,-13] %a = 13x - 13
b = [-13,9,8] %b = -13x^2 + 9x + 8
ab = sym2poly(poly2sym(a, s)*poly2sym(b, s))
Result
>> ab
ab =
-169 286 -13 -104

Saleh AlSenaidi
Saleh AlSenaidi el 26 de Nov. de 2021
Editada: Saleh AlSenaidi el 27 de Nov. de 2021
If you don't have symbolic toolbox, you can use this code
a = [13,-13]; %a = 13x - 13
b = [-13,9,8]; %b = -13x^2 + 9x + 8
roots_a =roots(a);
roots_b =roots(b);
ab =a(1,1)*b(1,1)*poly([roots_a.',roots_b.'])
Note: X.' is the non-conjugate transpose of X.
Resut
>> ab
ab =
-169 286 -13 -104

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by