| Symbolic Math Toolbox | ![]() |
Syntax
R = collect(S) R = collect(S,v)
Description
For each polynomial in the array S of polynomials, collect(S) collects terms containing the variable v (or x, if v is not specified). The result is an array containing the collected polynomials.
Examples
The following statements
syms x y;returnR1 = collect((exp(x)+x)*(x+2))R2 =collect((x+y)*(x^2+y^2+1), y)R3 = collect([(x+1)*(y+1),x+y])
R1 = x^2+(exp(x)+2)*x+2*exp(x) R2 = y^3+x*y^2+(x^2+1)*y+x*(x^2+1) R3 = [(y+1)*x+y+1, x+y]
See Also
expand, factor, simple, simplify, syms
| ccode | colspace | ![]() |