how to say 2 variables are equal and solve for one variable? I have two eqations having variables a and x. After integrating the equation, i get the solution 'y' in terms of 'a' and 'x'. Now I wand to differentiate 'y' w.r.t. 'a' for a=x. How to do?

조회 수: 4 (최근 30일)
syms x a
Mx = (-150 + 20.556*x - ((1/2)*(x-10)^2 - (1/60)*(x-10)^3))*heaviside(20-x) + (5.556*x+(250/3))*heaviside(x-20);
delM = (a*(1-x/30))*heaviside(20-a) + (x*(1-a/30)*heaviside(20-x) + a*(1-x/30)*heaviside(x-20))*heaviside(a-20);
y = vpa((int(Mx*delM,x,0,30)),6)
  댓글 수: 2
Ramneet Sidhu
Ramneet Sidhu 2019년 10월 25일
I an getting the solution for y as:
y =
0.00000262726*int(-a*heaviside(20 - a)*(x/30 - 1)*((1389*x)/250 + 250/3), x, 20, 30) + 0.00000262726*int(-a*heaviside(20 - a)*(x/30 - 1)*((5139*x)/250 - (x - 10)^2/2 + (x - 10)^3/60 - 150), x, 0, 20) + 0.00000262726*int(-a*heaviside(a - 20)*(x/30 - 1)*((1389*x)/250 + 250/3), x, 20, 30) + 0.00000262726*int(-x*heaviside(a - 20)*(a/30 - 1)*((5139*x)/250 - (x - 10)^2/2 + (x - 10)^3/60 - 150), x, 0, 20)
Ramneet Sidhu
Ramneet Sidhu 2019년 10월 25일
That helped a lot. Thankyou!!
In continuation of this question, I am trying to find the derivative of the result and equate it equal to 0 for a>20. This is the code I am trying:
syms a x
E = 29000*12^2; %ksf
I = 1890/12^4; %ft^4
M = (-150 + 20.556*x - ((1/2)*(x-10)^2 - (1/60)*(x-10)^3))*heaviside(20-x) + (5.556*x+(250/3))*heaviside(x-20);
m = x*(1-a/30)-(x-a)*heaviside(x-a);
y = simplify(int(expand(M*m),x,0,30))/(E*I)
assume(a > 0 )
assume(a>20)
f1 = diff(y,a)
eq1 = f1 ==0
a1 = solve(eq1,a)
And this gives me the following result:
y =
piecewise(a <= 0, (17753*a)/17128125, 20 <= a, (11668*a*heaviside(20 - a))/5709375 - (66448*heaviside(20 - a))/1141875 - (29168*heaviside(30 - a))/126875 - (117256*a)/17128125 + (25001*a*heaviside(30 - a))/1903125 + (13*a^2*heaviside(20 - a))/45675 - (2963*a^3*heaviside(20 - a))/190312500 + (a^4*heaviside(20 - a))/4567500 - (a^5*heaviside(20 - a))/456750000 - (a^2*heaviside(30 - a))/9135 - (463*a^3*heaviside(30 - a))/190312500 + 234512/1141875, a in Dom::Interval([0], [20]), (66448*heaviside(a - 20))/1141875 - (17251*a)/17128125 - (11668*a*(heaviside(a - 20) - 1))/5709375 - (13*a^2*(heaviside(a - 20) - 1))/45675 + (2963*a^3*(heaviside(a - 20) - 1))/190312500 - (a^4*(heaviside(a - 20) - 1))/4567500 + (a^5*(heaviside(a - 20) - 1))/456750000)
f1 =
(29168*dirac(a - 30))/126875 + (11668*heaviside(20 - a))/5709375 + (25001*heaviside(30 - a))/1903125 + (a^2*dirac(a - 30))/9135 + (463*a^3*dirac(a - 30))/190312500 + (26*a*heaviside(20 - a))/45675 - (2*a*heaviside(30 - a))/9135 - (2963*a^2*heaviside(20 - a))/63437500 + (a^3*heaviside(20 - a))/1141875 - (a^4*heaviside(20 - a))/91350000 - (463*a^2*heaviside(30 - a))/63437500 - (25001*a*dirac(a - 30))/1903125 - 117256/17128125
eq1 =
(29168*dirac(a - 30))/126875 + (11668*heaviside(20 - a))/5709375 + (25001*heaviside(30 - a))/1903125 + (a^2*dirac(a - 30))/9135 + (463*a^3*dirac(a - 30))/190312500 + (26*a*heaviside(20 - a))/45675 - (2*a*heaviside(30 - a))/9135 - (2963*a^2*heaviside(20 - a))/63437500 + (a^3*heaviside(20 - a))/1141875 - (a^4*heaviside(20 - a))/91350000 - (463*a^2*heaviside(30 - a))/63437500 - (25001*a*dirac(a - 30))/1903125 - 117256/17128125 == 0
a1 =
Empty sym: 0-by-1
Please tell me how to resolve this. Much appreciated!!

댓글을 달려면 로그인하십시오.

답변 (1개)

Surya Talluri
Surya Talluri 2020년 8월 6일
I understand that you want to get y as a function of x, a and after that you want to using x=a condition and find a>20 at which diff(y) becomes 0.
For that limits of integral should be from 0 to x
y = simplify(int(expand(M*m),x , 0, x))/(E*I);
y = subs(y, x, a)
the above generated y is a piecewise function and if you set the condition that a>20, it comes down to single expression
assume(a>20)
f1 = diff(y,a);
eq1 = f1 ==0;
S = simplify(eq1);
a1 = solve(S,a);
a1 = vpa(a1)
a1 =
22.827639369688447070895637509608
From the code that you have mentioned in the comments, simplifying eq1 gives Symfalse as an output, which shows that there is no a >20 which satisfies the condition if you directly replace integral bound with 30.
S = simplify(eq1)
S =
Symfalse
You can refer to Symfalse documentation for further understanding - https://www.mathworks.com/help/symbolic/symfalse.html

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by