partfrac() function returning same expression that was given as input

I have the following expression:
(4*l^2*m5 - 2*dl^2*m5*cos(2*THETA1(t) - 4*THETA2(t) + 4*THETA3(t) - 4*THETA4(t) + 2*THETA5(t)))/(12*dl^2)
I want the denominator (i.e. 12*dl^2) to be divided across all the numerator terms so that the resulting expression is the sum of a bunch of terms.
partfrac((4*l^2*m5 - 2*dl^2*m5*cos(2*THETA1(t) - 4*THETA2(t) + 4*THETA3(t) - 4*THETA4(t) + 2*THETA5(t)))/(12*dl^2))
ans =
(- m5*cos(2*THETA1(t) - 4*THETA2(t) + 4*THETA3(t) - 4*THETA4(t) + 2*THETA5(t))*dl^2 + 2*m5*l^2)/(6*dl^2)
When I use the partfrac() function in MATLAB to do this, it gives me almost the same expression again.
Please help.

 採用された回答

Star Strider
Star Strider 2020 年 4 月 19 日

0 投票

The partfrac function needs more information, specifically the variable (not expression) that you want it to use.
This (note that I provided the variable ‘dl’ and a useful name-value pair):
syms dl l m5 t THETA1(t) THETA2(t) THETA3(t) THETA4(t) THETA5(t)
Eq = (4*l^2*m5 - 2*dl^2*m5*cos(2*THETA1(t) - 4*THETA2(t) + 4*THETA3(t) - 4*THETA4(t) + 2*THETA5(t)))/(12*dl^2);
Eq_pf = partfrac(Eq, dl, 'FactorMode','full')
produces:
Eq_pf =
(l^2*m5)/(3*dl^2) - (m5*cos(2*THETA1(t) - 4*THETA2(t) + 4*THETA3(t) - 4*THETA4(t) + 2*THETA5(t)))/6
That is as much as it can do.
.

2 件のコメント

Thejus Jose
Thejus Jose 2020 年 4 月 20 日
Thank you. This works.
Star Strider
Star Strider 2020 年 4 月 20 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Modify Image Colors についてさらに検索

製品

リリース

R2019a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by