Symbolic Expression
The solve function solves an equation and returns the solution(s) as symbolic expressions. The answer can be converted to numbers by using any numeric function, like double:
>> x = sym('x');
>> solve('2*x^2 + x = 6')
ans =
3/2
-2
>> double(ans)
ans =
1.5000
-2.0000
When an expression is passed to the solve function instead of an equation, it will set the expression equivalent to 0 and solve the resulting equation. For illustration, this will solve
3x2 + x = 0:
>> solve('3*x^2 + x')
ans =
0
-1/3