フィルターのクリア

Replacing variables with dummy variables

2 ビュー (過去 30 日間)
Roy Cornelissen
Roy Cornelissen 2018 年 10 月 2 日
コメント済み: Star Strider 2018 年 10 月 2 日
Hello everyone,
I have obtained a really long equation in Matlab containing a lot of variables. Is there a function in Matlab that can find N suitable dummy variables in which it can compress the found combinations of the actual variables?
Forex:
y(x) = A*log(x)+A*B*sin(x)+C*e^x
Where:
A = 2*a+b+5*c+2*d
B = c+d/a
C = a^2+c^4/b+b/2
(the actual equation is much longer)
Thanks in advance!
  2 件のコメント
Adam
Adam 2018 年 10 月 2 日
What is wrong with doing it in exactly the way you show? Creating your own variables that roll together a number of other variables into a simpler equation.
Roy Cornelissen
Roy Cornelissen 2018 年 10 月 2 日
Since the obtained answer is: (D*((4*c1^2*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/b^3 + (12*c2^2*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/b^3 + (144*c3^2*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/(5*b^3) + (12*c1*c2*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/b^3 + (16*c1*c3*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/b^3 + (36*c2*c3*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/b^3 + (pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(3*a*b) + (b*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(18*a^3) + (2*c1*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(3*a*b) + (2*c2*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(3*a*b) + (2*c3*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(3*a*b) + (b*c1*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(12*a^3) + (b*c2*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(15*a^3) + (b*c3*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(18*a^3) + (4*c1^2*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(9*a*b) + (3*c2^2*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(5*a*b) + (16*c3^2*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(21*a*b) + (b*c1^2*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(30*a^3) + (b*c2^2*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(42*a^3) + (b*c3^2*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(54*a^3) + (c1*c2*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(a*b) + (16*c1*c3*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(15*a*b) + (4*c2*c3*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2))/(3*a*b) + (b*c1*c2*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(18*a^3) + (b*c1*c3*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(21*a^3) + (b*c2*c3*pi^3*(32*t + 3*pi - 6*pi*t + 51*pi*t^2 - 32*t^2))/(24*a^3)))/2 + (k_rx*((a*(4*t^2 - 2*t + 1))/2 - (16*a*t*(t - 1))/(3*pi)))/(2*b^2) + (b*k_ry*pi^2*(t - 1)^2*(252*c1^2 + 420*c1*c2 + 360*c1*c3 + 630*c1 + 180*c2^2 + 315*c2*c3 + 504*c2 + 140*c3^2 + 420*c3 + 420))/(1260*a^2) + (a*k_rx*(2*c1 + 3*c2 + 4*c3 + 1)^2*(32*t + 3*pi - 6*pi*t + 12*pi*t^2 - 32*t^2))/(12*b^2*pi) - (b*q_xx*pi*(32*t + 3*pi - 6*pi*t + 15*pi*t^2 - 32*t^2)*(252*c1^2 + 420*c1*c2 + 360*c1*c3 + 630*c1 + 180*c2^2 + 315*c2*c3 + 504*c2 + 140*c3^2 + 420*c3 + 420))/(15120*a)
It is not really clear how to compress the variables and coefficients.

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

採用された回答

Star Strider
Star Strider 2018 年 10 月 2 日
The only one that I can think of is the Symbolic Math Toolbox coeffs (link) function. Others, such as simplify (link), and related functions linked to on that page, could also be useful.
  2 件のコメント
Roy Cornelissen
Roy Cornelissen 2018 年 10 月 2 日
I tried but Matlab return the following:
Error using symengine The indeterminate is invalid.
Star Strider
Star Strider 2018 年 10 月 2 日
Please post the code you used, including the syms declaration.
You would likely have to use the expand function first, to get rid of the fractions, and if the result was a fraction, then use numden, and then simplify and coeffs on both the numerator and denominator.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by