필터 지우기
필터 지우기

Error returned with solve function

조회 수: 1 (최근 30일)
Uku
Uku 2012년 7월 7일
Hello!
I'm a bit puzzled when trying to solve a simple equation, taken as an example from the Matlab documentation:
syms a b c x
solve(a*x^2 + b*x + c == 0)
This returns:
??? Error using ==> char Conversion to char from logical is not possible.
Error in ==> solve>getEqns at 189 vc = char(v);
Error in ==> solve at 67 [eqns,vars] = getEqns(varargin{:});
Quite the opposite to what the example displays.
How can I solve this? Uku

답변 (1개)

Walter Roberson
Walter Roberson 2012년 7월 7일
You are using an older version of MATLAB that evaluates the truth of the comparison expression (creating a logical) before it calls solve()
Alternately, you might have assignments to a, b, c, and x before the solve() call, and if those assignments are all numeric values then the "symbolness" of the variables would be over-written, leaving a*x^2 + b*x + c as being a numeric variable, whose numeric value would be compared to 0 and that result passed to solve()

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by