Uso do calculo simbólico na Matlab
Ir para navegação
Ir para pesquisar
Use subs to Evaluate Expressions and Functions
Evaluation is one of the most common mathematical operations. Therefore, it is important to understand how and when Symbolic Math Toolbox™ performs evaluations. For example, create a symbolic variable, x, and then assign the expression x^2 to another variable, y.
syms x y = x^2;
Now, assign a numeric value to x.
x = 2;
This second assignment does not change the value of y, which is still x^2. If later you change the value of x to some other number, variable, expression, or matrix, the toolbox remembers that the value of y is defined as x^2. When displaying results, Symbolic Math Toolbox does not automatically evaluate the value of x^2 according to the new value of x.
y
y = x^2
To enforce evaluation of y according to the new value of x, use the subs function.
subs(y)
ans = 4