unexpected error for numeric::linsolve

3 visualizaciones (últimos 30 días)
Colby Crenshaw
Colby Crenshaw el 23 de Mayo de 2018
Respondida: Walter Roberson el 23 de Mayo de 2018
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])

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Mayo de 2018
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.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by