A matlab warning on solving equations

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
mech-eng
Messages
826
Reaction score
13
Hi,
>> d = 'x^2 + 9*x –7 = 0';
>> solve(d)
Error using solve>processString (line 354)
' x^2 + 9*x –7 = 0 ' is not a valid expression or equation.

Error in solve>getEqns (line 284)
eqns = processString(eqns, v, vc);

Error in solve (line 160)
[eqns,vars,options] = getEqns(varargin{:});

I can not understand what is the problem here?
 
Physics news on Phys.org
You aren't using the right syntax.
Code:
syms x
solve('x^2+9*x-7==0',x)
 
ans =
 
   109^(1/2)/2 - 9/2
 - 109^(1/2)/2 - 9/2

eval(ans)

ans =

    0.7202
   -9.7202