The second argument must be a vector of symbolic variables
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Standardtrickyness
am 28 Aug. 2017
Kommentiert: Standardtrickyness
am 7 Jul. 2018
y=solve(I*x == zeros(3,1) , x .* x ==x , 'ReturnConditions', true)
Error using sym.getEqnsVars>checkVariables (line 92)
The second argument must be a vector of symbolic variables.
Can someone explain to me what is wrong with this?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Aug. 2017
You can use one array or vector of equations, or you can use multiple individual equations, but you cannot use multiple arrays or vectors of equations. You will need to construct a single array or vector from the parts.
3 Kommentare
Walter Roberson
am 7 Jul. 2018
Bearbeitet: Walter Roberson
am 7 Jul. 2018
"you just translated matlab error"
I disagree.
The syntax documentation https://www.mathworks.com/help/symbolic/solve.html#buezrr6-eqns is not completely clear as to how to enter a system of equations. If one followed the conventions of the rest of the MATLAB documentation, the implication of the documented syntaxes would be that a system of equations would have to be entered as a vector or array, but the documentation has an explicit example at https://www.mathworks.com/help/symbolic/solve.html#buezrr6-ReturnConditions showing that multiple equations can be entered as separate arguments (which was the situation historically.) And historically, the closely related dsolve() permitted a separate argument for the initial conditions compared to the equations
It was thus entirely reasonable for the user "Standardtrickyness" to have attempted to pass multiple arguments of equations. I had to dig into the solver code to establish that you can either pass individual equations as separate arguments (historical arrangement) or you can pass an array or vector of equations (what the large majority of the current documentation uses), but that you cannot do both. My memory from last year is that it took me about 25 minutes of debugging of the Mathworks code to work out what was and was not permitted.
"provide solution for help"
You will need to construct a single array or vector from the parts.
For example, instead of
y=solve(I*x == zeros(3,1) , x .* x ==x , 'ReturnConditions', true)
you could use
eqn1 = I*x == zeros(3,1);
eqn2 = x .* x ==x;
y = solve( [eqn1(:); eqn2(:)], 'ReturnConditions', true)
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!