Solve Function - Having Difficulties
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
SJ Won
le 4 Juil 2019
Réponse apportée : Vaibhav Tomar
le 4 Juil 2019
I'm having trouble using the solve function and I don't understand the problem. I looked at other posts + documentation but I still don't see it.
>> x = solve('x+4==2',x)
Error using solve>getEqns (line 418)
List of equations must not be empty.
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
This is the input I entered and the error I'm receiving.
0 commentaires
Réponse acceptée
Plus de réponses (1)
Vaibhav Tomar
le 4 Juil 2019
Quotes are necessary as it's a string.
You need to use str2sym
str2sym(symstr) evaluates symstr where symstr is a string representing a symbolic expression. Enter symbolic expressions as strings only when reading expressions from text files or when specifying numbers exactly. Otherwise, do not use strings for symbolic input.
Use:
x=sym('x')
solx= solve(str2sym('x+4==2'),x)
0 commentaires
Voir également
Catégories
En savoir plus sur Food Sciences dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!