How to change power form in result?
1 view (last 30 days)
Show older comments
Hello, i have small problem.
How to change power form in result like this:
matlab script:
clc
clear
syms s z
Hs=0.5*s/(0.25*s^2+0.5*s+1);
Gs=2+(2/(0.1*s));
F1s=Hs*Gs;
F2s=(Hs/(1+Gs*Hs));
F1ss=simplify(F1s)
F2ss=simplify(F2s)
s1 = symfun(1/0.1*(1-z^-1),[z]);
F1z = symfun(( (4*s1+40)/((s1)^2+2*s1+4) ), [z]);
F2z = symfun(( (2*s1)/(((s1)^2)+6*s1+44) ), [z]);
F1zz=simplify(F1z)
F2zz=simplify(F2z)
and result:
F1ss =
(4*s + 40)/(s^2 + 2*s + 4)
F2ss =
(2*s)/(s^2 + 6*s + 44)
F1zz(z) =
(10*z*(2*z - 1))/(31*z^2 - 55*z + 25)
F2zz(z) =
(5*z*(z - 1))/(51*z^2 - 65*z + 25)
and i want to have for example
F1zz(z) =
10*(2 - z^(-1))/(31-55*z^(-1)+25*z^(-2))
or the best will be if i can get form like that:
F1zz(z) =
(10/31)*(2 - z^(-1))/(1-(55/31)*z^(-1)+(25/31)*z^(-2))
how i can make result in this format? (i mean in negative powers in result) cuz of the result is this same, but i just want other form
Answers (1)
Walter Roberson
on 9 Nov 2016
You will need to use feval(symengine) or evalin(symengine) and inside there you will need to use subsop() and at least two nested hold() calls. I suspect that you will end up needing four nested hold() calls.
All of which is to say that fighting how the symbolic engine wants to present the information is tricky and time consuming and fragile. It has rules it uses but the rules are obsure even in simple expressions.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!