How can I expand polynomials with matlab?
Afficher commentaires plus anciens
Can matlab expand something like the following and represent it in terms of powers of 'x'?
x(x-7)(x-6) + (x+4)(x-9)(x-2) + x(x-8)(x+1) ----> k_1 x^3 + k_2 x^2 + k_3 x + k_4
1 commentaire
Star Strider
le 14 Jan 2015
It can if you have the Symbolic Math Toolbox.
Réponse acceptée
Plus de réponses (1)
Star Strider
le 14 Jan 2015
An alternative using poly (assuming I got the maths correct) is:
% f(x) = x(x-7)(x-6) + (x+4)(x-9)(x-2) + x(x-8)(x+1)
rts1 = [ 0 7 6];
rts2 = [-4 9 2];
rts3 = [ 0 8 -1];
trm1 = poly(rts1);
trm2 = poly(rts2);
trm3 = poly(rts3);
ply = trm1 + trm2 + trm3;
produces:
ply =
3 -27 8 72
Catégories
En savoir plus sur Number Theory dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!