Help with symbolic toolbox

조회 수: 4 (최근 30일)
Robert
Robert 2016년 11월 19일
편집: Karan Gill 2017년 10월 17일
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)

채택된 답변

Karan Gill
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개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by