Rearrange Variables in an equation
Afficher commentaires plus anciens
I declare the variables using sym or syms then i have an equation a+2*b=1; I want MATLAB to give me a=1-2*b; or alternatively b=(1-a)/2;
is there a way to do this?
Also, There maybe more than 2 variables Equation maybe linear or non-linear Equation can change at each iteration. Thanks
Réponse acceptée
Plus de réponses (2)
Nitesh khanna
le 1 Août 2020
0 votes
how to replace the variables a, b, c, d by variables w, x, y, z for; in eqn
eqn=a+b+c+d==9;
will this command work
eqn=subs(eqn, [a,b,c,d],[w,x,y,z])
Bill Tubbs
le 29 Jan 2023
>> syms a b
>> eqn1 = b == (1 - a) / 2;
>> isolate(eqn1, a)
ans =
a == 1 - 2*b
>> isolate(eqn1, b)
ans =
b == 0.5000 - 0.5000*a
2 commentaires
Walter Roberson
le 29 Jan 2023
.. Though mind you, that was not an option back in 2012 !
Star Strider
le 29 Jan 2023
Definitely!
I’ve used isolate extensively in my Answers since it was introduced, when its use was appropriate.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!