there is a error for solving equations

조회 수: 2 (최근 30일)
math search
math search 2014년 6월 6일
댓글: A Jenkins 2014년 6월 6일
>> 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{:});

답변 (2개)

A Jenkins
A Jenkins 2014년 6월 6일
When I copy/paste your code, I get that the '–' is the wrong character: it is the 'dash' (U+2013) character instead of the 'minus' (U+002D) character.
Does this work?
d = 'x^2 + 9*x - 7 = 0';
solve(d)

math search
math search 2014년 6월 6일
Thank you it works now but how can you find names of that characters?
  댓글 수: 1
A Jenkins
A Jenkins 2014년 6월 6일
The following worked for me, though it might be system dependent.
>> dec2hex('-')
ans =
2D
>> dec2hex('–')
ans =
2013

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by