I am getting the error message "unable to find symbolic solution" using dsolve.

I am using the same process that I have been using to solve differential equations, with the exception of the a substitution (I have three sets of initial conditions). I think it might have something to do with the variable being inside two different trig functions, but I am not entirely sure, as I have not solved an equation like this before. The type of output I'm looking for is an equation that I can clean up and plot for theta versus t. What exactly am I doing wrong? Is there a better way to solve this?
The outputs I am getting are:
sola =
[ empty sym ]
syms theta(t) a t
Dtheta = diff(theta,t,1);
D2theta = diff(theta,t,2);
L = 1;
g = 9.81;
ode = L*D2theta + g*sin(theta) == a*cos(theta);
cond0a = Dtheta(0) == 0.5;
cond0b = Dtheta(0) == 3;
cond0c = Dtheta(0) == 3;
cond1 = theta(0) == 0;
condsa = [cond0a, cond1];
condsb = [cond0b, cond1];
condsc = [cond0c, cond1];
aa = 5;
ab = 5;
ac = 0.5*t;
sola = dsolve(subs(ode,a,aa),condsa)
Warning: Unable to find symbolic solution.
sola = [ empty sym ]
solb = dsolve(subs(ode,a,ac),condsb)
Warning: Unable to find symbolic solution.
solb = [ empty sym ]
solc = dsolve(subs(ode,a,ac),condsc)
Warning: Unable to find symbolic solution.
solc = [ empty sym ]

1 Comment

syms theta(t) a t
Dtheta = diff(theta,t,1);
D2theta = diff(theta,t,2);
L = 1;
g = 9.81;
ode = L*D2theta + g*sin(theta) == a*cos(theta);
cond0a = Dtheta(0) == 0.5;
cond0b = Dtheta(0) == 3;
cond0c = Dtheta(0) == 3;
cond1 = theta(0) == 0;
condsa = [cond0a, cond1];
condsb = [cond0b, cond1];
condsc = [cond0c, cond1];
aa = 5;
ab = 5;
ac = 0.5*t;
eqn1 = subs(ode,a,aa); disp(char(eqn1))
(981*sin(theta(t)))/100 + diff(theta(t), t, t) == 5*cos(theta(t))
sol1 = dsolve(eqn1); disp(char(sol1))
[-log(1212361^(1/2)*(- 981/1212361 - 500i/1212361))*1i; log(2)*1i - (log(2849444/1212361 + 3924000i/1212361)*1i)/2]
The dsolve() unconstrained results in a pair of solutions, both of which are constants. Those constant solutions do not meet the constraints, so dsolve() with constraints returns empty.

Sign in to comment.

Answers (1)

What exactly am I doing wrong?
Nothing. "dsolve" is simply not able to find an analytical solution because the problem is too difficult.
Is there a better way to solve this?
Use a numerical solver (like ode45).
L = 1;
g = 9.81;
a = 5;
fun = @(t,y) [y(2);(-g*sin(y(1))+a*cos(y(1)))/L];
tspan = [0 5];
y0 = [0;0.5];
[T,Y] = ode45(fun,tspan,y0);
plot(T,Y(:,1))

Categories

Products

Release

R2024b

Asked:

on 30 Nov 2024

Moved:

on 30 Nov 2024

Community Treasure Hunt

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

Start Hunting!