Symbolic expressions and algebra:
The “sym” function can be used to create a “symbolic objects” in MATLAB. If the input argument to sym is a string, the result is a symbolic number or variable. If the input argument is a numeric, scalar or matrix, the resulting is a symbolic representation of the given numeric values. For example, typing x=sym (‘x’) creates the symbolic variable with name x, and typing y=sym(‘y’) creates a symbolic variable named y. typing x=sym(‘x’,’real’) tells MATLAB to assume that x is real. Typing x=sym(‘x’,’unreal’) tells MATLAB to assume that x is not real.
The “syms” function enables you to combine more than one such statement into a single statement. For example typing syms x is equivalent to typing x=sym(‘x’), and typing syms x y u v creates the four symbolic variables x, y, u and v. when used without arguments, syms lists the symbolic objects in the work space. The syms command, however, cannot be used to create symbolic constants.
The syms command enables you to specify that certain variables are real. For example,
>>syms x y real
Manipulating expressions:
The following functions can be used to manipulate expressions by collecting