unexpected error for numeric::linsolve

조회 수: 3 (최근 30일)
Colby Crenshaw
Colby Crenshaw 2018년 5월 23일
답변: Walter Roberson 2018년 5월 23일
I am trying to solve a system of inequalities, and I am using the numeric::linsolve command but I keep getting an 'unexpected error' that says that the '::' usage is an invalid matlab syntax. Help?
numeric::linsolve({2*x + 2*y = 18, 1*x + 3*y = 12, 4*x + 3*y >= 24, z = .20*x + .25*y}, [x, y, z])

답변 (1개)

Walter Roberson
Walter Roberson 2018년 5월 23일
Anything you see with "::" in its name can only be invoked from the Symbolic Engine. R2018a is the last release in which you can invoke
notebook
to get an interactive interface to execute the commands.
In the meantime, you can use
syms x y z
eqn = [2*x + 2*y == 18, 1*x + 3*y == 12, 4*x + 3*y >= 24, z == .20*x + .25*y];
sol = solve(eqn);
[sol.x, sol.y, sol.z]
This will give you single values.
With this particular system of inequalities, the single values are the only solution. However, in general when you solve() with inequalities, solve() might return a "representative" solution instead of indicating a range of solutions. The rules for which representative values are chosen are not documented, but I worked them out in the past and posted the rules.

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by