How to expose a symbol from an equation? I have Symbolic Math Toolbox, if it is necessary
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
matico
am 23 Aug. 2015
Bearbeitet: Star Strider
am 23 Aug. 2015
Let say I have an equation like:
y = @(x) x^2 + 2;
I want to express X in dependence of Y like:
x = @(y) sqrt(y-2);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Aug. 2015
Bearbeitet: Star Strider
am 23 Aug. 2015
You have to set a few rules for the Symbolic Math Toolbox, but this is one possibility:
syms x y positive
assume(y > 2)
Eqn = y == x^2 + 2;
x = solve(Eqn)
x =
(y - 2)^(1/2)
EDIT — If you want to create an anonymous function from ‘x’, use the matlabFunction function.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!