Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

coeffs - List coefficients of multivariate polynomial

Syntax

C = coeffs(p)
C = coeffs(p, x)
[C, T] = coeffs(p, x)

Description

C = coeffs(p) returns the coefficients of the polynomial p with respect to all the indeterminates of p.

C = coeffs(p, x) returns the coefficients of the polynomial p with respect to x.

[C, T] = coeffs(p, x) returns a list of the coefficients and a list of the terms of p. There is a one-to-one correspondence between the coefficients and the terms of p.

Examples

List the coefficients of the following single-variable polynomial:

syms x
t = 16*log(x)^2 + 19*log(x) + 11;
coeffs(t)

The result is:

ans =
[ 11, 19, 16]
 

List the coefficients of the following polynomial with respect to the indeterminate sin(x):

syms a b c x
y = a + b*sin(x) + c*sin(2*x);
coeffs(y, sin(x))

The result is:

ans =
[ a + c*sin(2*x), b]
 

List the coefficients of the following multivariable polynomial with respect to all the indeterminates and with respect to the variable x only:

syms x y
z = 3*x^2*y^2 + 5*x*y^3;
coeffs(z)
coeffs(z,x)

The results are:

ans =
[ 5, 3]
 
ans =
[ 5*y^3, 3*y^2]
 

Display the list of the coefficients and the list of the terms of the following polynomial expression:

syms x y
z = 3*x^2*y^2 + 5*x*y^3;
[c,t] = coeffs(z,y)

The results are:

c =
[ 5*x, 3*x^2]
 
t =
[ y^3, y^2]

See Also

sym2poly

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS