# Help with symbolic toolbox

9 ビュー (過去 30 日間)
Robert 2016 年 11 月 19 日

Struggling with symbolic toolbox again
All i want to do is the following. I want to give it an equation called ess that has many symbolic variables in it.
Im going to sub in a specific value for one of the variables.
Then i want it to rearrange itself in terms of ess and give me the result as a ratio of two variable that are in the original equation.
Cant get it to work. Here is what I've been trying. Obviously it doesn't work but here is what I'm trying
syms P S Z ess ratio
ess = (S-P)/(S^2-S*Z)
S1 = -2+2*sqrt(3)*i
ess = subs(ess,S,S1)
assume(ess == 1/50)
solve(ess== Z/P, Z/P)
% Now ess should be only in terms of Z and P
%I want matlab to tell me what Z/P is interms of ess, So i want it to
%rearrange itself and say Z/P = (ess+ some numbers/some more numbers - ess)
%or whatever form it turns out to be but now ess is equal to the number
%1/50
I have also tried this version by solving by hand for Z and P and then asking it what Z/P is but it gives me an answer in terms of P still where P should no longer exists
syms Z P S
ess = 1/50
Z = (S^2-((S-P)/(ess)))/S
P = S-ess*(S^2-S*Z)
ratio = Z/P
S = -2 + 2*sqrt(3)*i

サインインしてコメントする。

### 採用された回答

Karan Gill 2016 年 11 月 21 日

You do not need to declare "ess". And you don't use "ratio". So your first line is
syms P S Z
"assume" is not the right way to declare equations. See the https://www.mathworks.com/help/symbolic/solve.html. Instead:
ess = (S-P)/(S^2-S*Z)
S1 = -2+2*sqrt(3)*i
ess = subs(ess,S,S1)
eqn = ess == 1/50
Now solve the equation for "P".
sol = solve(eqn,P)
sol =
- Z/25 + (3^(1/2)*54i)/25 - 46/25 + (3^(1/2)*Z*1i)/25
As you can see, it isn't possible to separate "Z" out from the solution to "P". Hence, you cannot get an answer in terms of Z/P.

サインインしてコメントする。

### カテゴリ

Find more on Symbolic Math Toolbox in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by