Solving Basic Algebraic Equations in Octave
The roots function is used for solving algebraic equations in Octave and you can write above examples as follows:
For example, let us solve for x in the equation x-5 = 0
roots([1, -5])
Octave will execute the above statement and return the following result −
ans = 5
You can also call the solve function as −
y = roots([1, -5])
Octave will execute the above statement and return the following result −
y = 5