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?
Ältere Kommentare anzeigen
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)
Antworten (1)
Surya Talluri
am 6 Aug. 2020
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
Kategorien
Mehr zu Code Performance finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!