How to Evaluate a MATLAB Symbolic Expression

How to Evaluate a MATLAB Symbolic Expression thumbnail
A symbolic expression uses letters instead of numbers to define the equation.

MATLAB is a technical computing software used in the engineering and science community for data processing and analysis. Data stored in array and matrix form is often manipulated and visualized by plotting the results. Symbolic expressions are equations that contain variables in the form of letters or symbols which represent a numeric value. MATLAB works with symbolic expressions which allow the equation to be simplified and evaluated when the symbols are defined in terms of their numeric values.

Instructions

    • 1

      Clear all active variables within the workspace by entering "Clear all" into the Command window.

    • 2

      Define the symbolic objects. Using an example in which two symbolic variables are required, for instance, x and y, input "syms x y" into the Command window.

    • 3

      Create the expression to solve using the symbolic terms. For example, to solve the equation "5=x+y," enter "solve('5=x+y', x)" into the Command window, where the first term is the equation to be solved and the second term "x" is the variable to be solved for. This outputs into the Command window "5-y" which is equivalent to "x=5-y."

    • 4

      Solve for one of the symbolic terms by defining a numeric value for the other symbolic value. For example, input "x=2" followed by "eval(solve('5=x+y', y))" into the Command window. This will output the number "3" which is equivalent to "y=3."

Tips & Warnings

  • A symbolic equation can be simplified by defining the variable as shown in Step 2 and then entering the equation into the Command window. For example, entering "x^2+3*x+y+2*y" outputs the simplified version "x^2 + 3*x + 3*y."

Related Searches:

References

  • Photo Credit Comstock/Comstock/Getty Images

Comments

You May Also Like

Related Ads

Featured