Rearrange Variables in an equation
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (2)
Nitesh khanna
am 1 Aug. 2020
0 Stimmen
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
am 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 Kommentare
Walter Roberson
am 29 Jan. 2023
.. Though mind you, that was not an option back in 2012 !
Star Strider
am 29 Jan. 2023
Definitely!
I’ve used isolate extensively in my Answers since it was introduced, when its use was appropriate.
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!