multiplying polynomials with conv

use matlab to carry out the following multiplication of polynomials
(x+1.4)(x-0.4)x(x+0.6)(x-1.4)
heres what i did---
a = [1,1.4];
b = [1, -.4];
c = [1, 0];
d = [1, .6];
e = [1, -1.4];
p = conv(a, conv(b, conv(c, conv(d, e))))
it gave me the correct result but its tagging an extra zero onto the end of my result. i assume this means its coming out as one higher power then it is supposed to be with a "0" constant. anyone see any problems here?
my answer is supposed to come out as
p = [1, 0.2, -2.2, -3.92, .4704]
while my work is giving me
p = [1, 0.2, -2.2, -3.92, .4704, 0]
so somewhere it is giving me an extra power of x and im not sure why

1 commentaire

Valeriy Fedorikhin
Valeriy Fedorikhin le 2 Juin 2015
Your answer is correct. There is a typo in the book - don't worry about it.

Connectez-vous pour commenter.

Réponses (2)

Fangjun Jiang
Fangjun Jiang le 24 Oct 2011

0 votes

That is because you have one term as x, right? So the result will not have the constant term, as you specify [1,0] for x.

3 commentaires

Morley
Morley le 24 Oct 2011
my answer is supposed to come out as
p = [1, 0.2, -2.2, -3.92, .4704]
while my work is giving me
p = [1, 0.2, -2.2, -3.92, .4704, 0]
so somewhere it is giving me an extra power of x and im not sure why
Fangjun Jiang
Fangjun Jiang le 24 Oct 2011
No! The p given by conv() is correct. Double check your formula. The x in the middle, do you mean x or *?
Morley
Morley le 24 Oct 2011
yes that is just an x
ok maybe my answer is coming out correct
now i need to plot

Connectez-vous pour commenter.

Iqra
Iqra le 29 Juin 2024
Modifié(e) : DGM le 3 Juil 2024
Question
use MATLAB to carry out the following multiplication of polynomial x(x 1.8)(x-0.4)(x-1.6) plot the polynomial in the domain "-2<=x<=2."
ANSWER
% Define the polynomials
P = [1 18 0]; % x(x + 18)
Q = [1 -2 -0.64]; % (x - 0.4)(x - 1.6)
% Multiply the polynomials
result = conv(P, Q);
% Plot the polynomial
fplot(@(x) polyval(result, x), [-2, 2]);
title('Plot of the Polynomial');
xlabel('x');
ylabel('P(x) * Q(x)');
grid on;

1 commentaire

DGM
DGM le 3 Juil 2024
Please format your answers. It's easier to read, and formatted code can be run right here on the forum, directly demonstrating the results.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Polynomials dans Centre d'aide et File Exchange

Produits

Question posée :

le 24 Oct 2011

Commenté :

DGM
le 3 Juil 2024

Community Treasure Hunt

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

Start Hunting!

Translated by