unexpected error for numeric::linsolve
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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])
0 Commenti
Risposte (1)
Walter Roberson
il 23 Mag 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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Equation Solving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!