How to solve an equation in terms of the other variable
80 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Phil
el 11 de Dic. de 2012
Respondida: Jeffery Devereux
el 26 de Feb. de 2018
I have the equation g^2+6*g*h+3h=0 for which I need to solve g in terms of h. Here is my attempt:
syms g h
g = solve('g^2+6*g*h+3*h=0')
For some reason this consistently only solves h in terms of g. Can someone point out to me what I am doing wrong?
0 comentarios
Respuesta aceptada
Walter Roberson
el 11 de Dic. de 2012
solve() has an algorithm for selecting which variable to solve for when it is not told which one to solve for. The algorithm is based upon the letter the variable name starts with.
You should specify which variable you want solved for:
g = solve('g^2+6*g*h+3*h=0', 'g')
Más respuestas (1)
Jeffery Devereux
el 26 de Feb. de 2018
you need to use two equal signs
g^2+6*g*h+3*h==0
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!