Help with symbolic toolbox
1 回表示 (過去 30 日間)
古いコメントを表示
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
answer = subs(ratio,S)
0 件のコメント
採用された回答
Karan Gill
2016 年 11 月 21 日
編集済み: Karan Gill
2017 年 10 月 17 日
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.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!