Solving equation with symbolic vector variable
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Rinu
il 16 Nov 2013
Commentato: Walter Roberson
il 7 Mag 2016
I want to solve an equation of the form: V/(A-V)=B where A and B are known vectors and V is the symbolic vector variable I want to solve for. I created V by >>V=sym('V',[n 1]); and solved the equation by using 'solve' but in the output I get only the 'names' of the elements - V1, V2, V3, ... How do I get the values of V1, V2,...? Any help is much appreciated.
2 Commenti
Risposta accettata
Walter Roberson
il 16 Nov 2013
V = B .* A ./ (B + 1);
15 Commenti
Walter Roberson
il 7 Mag 2016
Alexander Kharlan:
V = B .* A ./ (B + 1)
is the solution to the question originally presented. It turned out that question originally presented was not the real question, and the real question was solved to the user's satisfaction.
The more general question of how to solve a symbolic vector equation depends upon the release you are using . In current releases, you just use solve() on the vector equation. In slightly older releases, you use num2cell() to break the vector up into a cell array, and then you use cell array expansion to push the elements as separate parameters to solve(). For example,
mveq = num2cell(myVectorOfEquations);
mvvar = num2cell(VariablesToSolveFor);
solve(mveq{:}, mvvar{:})
Walter Roberson
il 7 Mag 2016
"If you are content with people doing your job for you"
Answering questions here is not my job. As far as I know, the only people who are paid to answer questions here are the Mathworks staff who work on the Answers forum software itself. Everyone else who answers questions here (including the other people who happen to work for Mathworks) does so as a volunteer. I do not work for Mathworks; I have never worked for Mathworks.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!