Solve symbolic equation for a variable which itself is a function of time

3 次查看(过去 30 天)
Hello
I am trying to solve a symbolic equation for the variable, theta_ddot.
I have defined the angle (theta) and acceleration (theta_ddot) as time dependant, which seems to cause a problem when I try to solve the equation symbolically. MATLAB give the warning: "Warning: Unable to find explicit solution. For options, see help"
I have tried to not define theta and theta_ddot as time dependant which solves the problem. However I need them to be time dependant since I have to take the time derivative later on so I can't do that.
I have attached my code below
syms m a J theta_ddot(t) theta(t) tau_1 g eq1
eq1 = (m*a^2 + J) * theta_ddot + a*g*m*cos(theta)
eq1(t) = 
S = solve(tau_1 == eq1,theta_ddot)
Warning: Unable to find explicit solution. For options, see help.
S = struct with fields:
t: [0×1 sym] tau_1: [0×1 sym]
Hope someone can help explain what seems to be the problem. :)
Thanks in advance

回答(1 个)

Steven Lord
Steven Lord 2023-9-26
If you're trying to solve a differential equation, try using dsolve instead of solve.
  2 个评论
Christian Noerkjaer
That unfortunately does not seem to help. Since the equation does not contain a derivative as matlab would understand it, it seems dsolve can't do the trick. I would very much like to avoid substituting the theta_ddot term back to the double partial derivative of theta.
syms m a J theta_ddot(t) theta(t) tau_1 g eq1
eq1 = (m*a^2 + J) * theta_ddot + a*g*m*cos(theta)
eq1(t) = 
S = dsolve(tau_1 == eq1,theta_ddot)
Error using symengine
No differential equations found. Specify differential equations by using symbolic functions.

Error in mupadengine/evalin_internal

Error in mupadengine/fevalHelper

Error in mupadengine/feval_internal

Error in dsolve>mupadDsolve (line 334)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);

Error in dsolve (line 203)
sol = mupadDsolve(args, options);
Walter Roberson
Walter Roberson 2023-9-26
编辑:Walter Roberson 2023-9-26
syms m a J theta_ddot(t) theta(t) tau_1 g eq1
theta_dot = diff(theta);
theta_ddot = diff(theta_dot);
eq1 = (m*a^2 + J) * theta_ddot + a*g*m*cos(theta)
eq1(t) = 
S = dsolve(tau_1 == eq1)
S = 
tdd = diff(S, t, t)
tdd = 
simplify(tdd, 'steps', 50)
ans = 
Derivative of union is not a good sign.
In the final result, the reason for there to be a conditional on the 0 and for there to be no other values, is that it is MATLAB's way of saying that the solution can be defined as 0 under those particular cases, but is otherwise undefined.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by