

You can get the numerical value of such roots by converting them to double. In case of higher order equations, roots are long containing many terms. For example, let us solve a cubic equation as (x-3) 2(x-7) = 0 The solve function can also solve higher order equations.

When you run the file, it displays the following result − The roots function is used for solving algebraic equations in Octave and you can write above examples as follows −ĭisp('The second root is: '), disp(s(2)) Solving Basic Algebraic Equations in Octave 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. So far, we have seen that all the examples work in MATLAB as well as its GNU, alternatively called Octave.
