
Where, you can also mention the variable.įor example, let us solve the equation v – u – 3t 2 = 0, for v.

If the equation involves multiple symbols, then MATLAB by default assumes that you are solving for x, however, the solve function has another form − You may even not include the right hand side of the equation − You can also call the solve function as − MATLAB will execute the above statement and return the following result − In its simplest form, the solve function takes the equation enclosed in quotes as an argument.įor example, let us solve for x in the equation x-5 = 0 The solve function is used for solving algebraic equations. Solving Basic Algebraic Equations in MATLAB We will also discuss factorizing and simplification of algebraic expressions.

But for solving basic algebraic equations, both MATLAB and Octave are little different, so we will try to cover MATLAB and Octave in separate sections. If you take a look at the syntax above, you just need to type the required symbolic variables, and functions after that.So far, we have seen that all the examples work in MATLAB as well as its GNU, alternatively called Octave. Use of ‘syms’ command is easier than ‘sym’ command in Matlab®. YOU CAN LEARN MatLab® IN MECHANICAL BASE Click And Start To Learn MatLab®! ‘syms’ Command In MatLab® > syms x y z We created a polynomial that can be operable with further factorizations or other kinds of mathematical operations. Because ‘x’ is defined as a symbolic variable, which has no exact value. If you look at the example above, there is no problem with ‘x’.

And in Matlab®, all the variables must have values. Because ‘x’ is not defined as a variable. In normal, if you write a polynomial like above into the Matlab® command window, you will face an error like above that says ‘Undefined function or variable ‘x’. We explained these codes with very basic examples below in the MatLab® command window. ‘sym’ command is a very useful command in Matlab® to create unknown variables to use in various polynomial and mathematical applications.
