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

 채택된 답변

Star Strider
Star Strider 2014년 10월 17일

1 개 추천

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

추가 답변 (1개)

zongquan
zongquan 2014년 10월 17일

0 개 추천

It works. Thank you, Star

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2014년 10월 17일

댓글:

2014년 10월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by