MATLAB: Solve for specific variable – like Excel’s solver

complex equationnumeric solutionsolvesolver

I would like to determine the value of a variable within a complex equation. For example, let's say my equation is y = mx + b. This is simplified but still useful. I know what y is, but I don't know what x is. I want to determine which value of x gives the known value of y. As another example, I am trying to tell MATLAB how to act like the Excel Solver add-in.
I have tried to follow various guides online and used simple equations as outlined below. I encounter the same error and I'm not sure what else I might try. How might I go about this process?
My example code and the corresponding error follows:
>> syms x;
t = solve('2*x+6==0', 'x');
Error using solve>getEqns (line 418)
List of equations must not be empty.
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});

Best Answer

The problem is with the single (or any other) quotes.
Remove them, and then:
syms x
t = solve(2*x+6==0, x)
produces:
t =
-3
.