Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

expand - Symbolic expansion of polynomials and elementary functions

Syntax

expand(S)

Description

expand(S) writes each element of a symbolic expression S as a product of its factors. expand is often used with polynomials. It also expands trigonometric, exponential, and logarithmic functions.

Examples

Expand the expression:

syms x;
expand((x-2)*(x-4))

The result is:

ans =
x^2 - 6*x + 8

Expand the trigonometric expression:

syms x y;
expand(cos(x+y))

The result is:

ans =
cos(x)*cos(y) - sin(x)*sin(y)

Expand the exponent:

syms a b;
expand(exp((a+b)^2))

The result is:

ans =
exp(2*a*b)*exp(a^2)*exp(b^2)

Expand the expressions that form a vector:

syms t;
expand([sin(2*t), cos(2*t)])

The result is:

ans =
[ 2*cos(t)*sin(t), cos(t)^2 - sin(t)^2]

See Also

collect, factor, horner, simple, simplify, syms

  


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