Clear Filters
Clear Filters

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

10 views (last 30 days)
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

Answers (1)

Steven Lord
Steven Lord on 26 Sep 2023
If you're trying to solve a differential equation, try using dsolve instead of solve.
  2 Comments
Christian Noerkjaer
Christian Noerkjaer on 26 Sep 2023
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 on 26 Sep 2023
Edited: Walter Roberson on 26 Sep 2023
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.

Sign in to comment.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!