how can I get "u" out of this equation

1 view (last 30 days)
sanam
sanam on 20 Sep 2019
Commented: Walter Roberson on 20 Sep 2019
Hello everyone! I have this equation in matlab and I don't know how to get "u" from this equation and solve it
udot(n) = (1/(k3*cos(x3(n))*cos(L*x3(n)/d))*(Jb+JB+mB*x1(n)^2))*(-f+k3*cos(x3(n))*cos(L*x3(n)/d)*u(n)*(1-beta1)-(L/d)*x4(n)*k3*cos(x3(n))*sin(L*x3(n)/d)+...
cos(L*x3(n)/d)*x4(n)*(k3*sin(x3(n))+beta1*k2*cos(x3(n)))+cos(x3(n))*g*beta1*(-0.5*mb-mB*x1(n))-2*mB*x1(n)*x2(n)*x4(n)*beta1)-beta2*x4(n)-...
beta3*((x1(n)*x4(n)^2-g*sin(x3(n)))/k1)-beta4*x2(n);
this equation is in a loop and n is the counter . x1,x2,x3 and x4 are the state variables.
thank u in advance for any ideas
  3 Comments
sanam
sanam on 20 Sep 2019
Edited: sanam on 20 Sep 2019
thanks, No all of those parameters( beta1,...x4) are known,except u & udot
I tried it but didn't get any answers :(
the answer was based on udot, but it shoulden't be
Walter Roberson
Walter Roberson on 20 Sep 2019
If both u and udot are unknown, then you have one of two possible situations:
  1. You have one equation in two unknowns. In such a case, it cannot be solved except parametrically -- in which case udot is already solved parametrically with respect to u, and the code I posted would solve for u parametrically in terms of udot; OR
  2. You have a differential equation.
syms beta1 beta2 beta3 beta4 d f g Jb JB mb mB k1 k2 k3 L u(t) u0 x1 x2 x3 x4
udot = diff(u,t);
eqn = udot == (1/(k3*cos(x3)*cos(L*x3/d))*(Jb+JB+mB*x1^2))*(-f+k3*cos(x3)*cos(L*x3/d)*u*(1-beta1)-(L/d)*x4*k3*cos(x3)*sin(L*x3/d)+cos(L*x3/d)*x4*(k3*sin(x3)+beta1*k2*cos(x3))+cos(x3)*g*beta1*(-0.5*mb-mB*x1)-2*mB*x1*x2*x4*beta1)-beta2*x4-beta3*((x1*x4^2-g*sin(x3))/k1)-beta4*x2;
sol = simplify( dsolve(eqn, u(0)==u0) )
It is difficult to make sense of the solution, but there is a solution.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!