O'Reilly logo

MATLAB Symbolic Algebra and Calculus Tools by César Pérez López

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 1

image

Symbolic Variables and Functions

1-1. Symbolic Variables

MATLAB deems as symbolic any algebraic expression whose variables have all been previously defined as symbolic; variables are declared as symbolic using the command syms. For example, if we want to treat as symbolic the expression 6 * a * b + 3 * a^2 + 2 * a * b, in order to simplify it, we need to declare the two variables a and b as symbolic, as shown here:

>> syms a b>> simplify(6*a*b + 3*a^2 + 2*a*b)
ans =8 * a * b + 3 * a ^ 2

As we will see, the command needed to transform a numeric expression to symbolic is sym. For example, if we want to simplify the numeric expression ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required