Symbolic Fraction Summation with Common Denominator

41 views (last 30 days)
Hello there, hope you are all doing well.
I have two symbolic fractions with different denominators and I would like to know the result of the subtraction of them. I tried simplify and simplifyFraction functions; however they do not yield the result I want. I want the result to be in the form of A/B.
Here are the fractions and the result I get:
syms M1 M2 K1 K2 B s
T1 = (B*s + K1)/ ((M1*M2)*s^4 + (M1*B+M2*B)*s^3 + (M1*K1+M2*K1+M1*K2)*s^2 + (B*K2)*s + (K1*K2));
T = (M1*s^2 + B*s + K1) / ((M1*M2)*s^4 + (B*M1+B*M2)*s^3 + (K1*M1+K1*M2+K2*M1)*s^2 + (B*K2+B*K1-B)*s + (K1^2 -K1 + K1*K2));
T2 = T1 - T
T2 =
(K1 + B*s)/(M1*M2*s^4 + (B*M1 + B*M2)*s^3 + (K1*M1 + K1*M2 + K2*M1)*s^2 + B*K2*s + K1*K2) - (M1*s^2 + B*s + K1)/(s^3*(B*M1 + B*M2) - K1 + s^2*(K1*M1 + K1*M2 + K2*M1) + K1^2 + s*(B*K1 - B + B*K2) + K1*K2 + M1*M2*s^4)
Can you tell me which specific function I need to use to obtain the T2 in the form of A/B?
  1 Comment
Swatantra Mahato
Swatantra Mahato on 19 Nov 2020
Hi Kaan,
When I execute the "simplifyFraction" function as below
T2 = simplifyFraction(T1 - T)
I get the output in the form A/B
T2 =
-(- B^2*K1*s^2 + B^2*s^2 - 2*B*K1^2*s + 2*B*K1*s + B*M1^2*s^5 + M2*B*M1*s^5 + K2*B*M1*s^3 - K1^3 + K1^2 + K1*M1^2*s^4 + M2*K1*M1*s^4 + K2*K1*M1*s^2 + M2*M1^2*s^6 + K2*M1^2*s^4)/((K1*K2 + B*K2*s + B*M1*s^3 + B*M2*s^3 + K1*M1*s^2 + K1*M2*s^2 + K2*M1*s^2 + M1*M2*s^4)*(K1^2 - B*s - K1 + K1*K2 + B*K1*s + B*K2*s + B*M1*s^3 + B*M2*s^3 + K1*M1*s^2 + K1*M2*s^2 + K2*M1*s^2 + M1*M2*s^4))
Can you provide the expected result and if you obtain it by solving by hand?
Thanks

Sign in to comment.

Answers (0)

Categories

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

Products

Community Treasure Hunt

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

Start Hunting!