Uso do calculo simbólico na Matlab

De MediaWiki do Campus São José
Revisão de 14h25min de 3 de junho de 2016 por Moecke (discussão | contribs) (Criou página com '=[http://www.mathworks.com/help/symbolic/use-subs-to-evaluate-expressions-and-functions.html Use subs to Evaluate Expressions and Functions]= Evaluation is one of the most common...')
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
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

Formula Rearrangement and Rewriting