Effacer les filtres
Effacer les filtres

Collect the term with certain order

2 vues (au cours des 30 derniers jours)
zongquan
zongquan le 17 Oct 2014
Commenté : Star Strider le 17 Oct 2014
Dear Everyone,
I have an extremely complicated multi-variablespolynomial expression.
For example,
z = a1 * x^2 + b1 * y^2 + c1* x^2 * y^2 + a2 * x^4 .....
I want to collect the coefficients of x^2, which is a1.
Everytime I use collect(z,x^2), it just returns a1*x^2 + c1* x^2* y^2 + a2 * x^4.
Does anyone have experience in extracting the exact term using collect function in Matlab?
Thanks,
Zongquan

Réponse acceptée

Star Strider
Star Strider le 17 Oct 2014
See if:
[C, T] = coeffs(z, [x y]);
does what you want. The coefficients are in ‘C’ and the corresponding terms in ‘T’.

Plus de réponses (1)

zongquan
zongquan le 17 Oct 2014
It works. Thank you, Star

Catégories

En savoir plus sur Polynomials dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by