Basic mathematical operations:
All the basic mathematical operations can be executed on symbolic expressions and variables (example, add, raise to a power, multiply, subtract, divide, etc.).
Here are some illustrations:
>> c/b
ans =
x^2
>> b^3
ans =
x^6
>> c*b
ans =
x^6
>> b + sym('4*x^2')
ans =
5*x^2
It can be view from the last illustration that MATLAB will collect like words in such expressions, adding the x2 and 4x2 to answer in 5x2.
The below generates a symbolic expression by passing a string, but the words are not automatically collected:
>> sym('z^3 + 2*z^3')
ans =
z^3 2*z^3