I am getting the error message "unable to find symbolic solution" using dsolve.
28 views (last 30 days)
Show older comments
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)
solb = dsolve(subs(ode,a,ac),condsb)
solc = dsolve(subs(ode,a,ac),condsc)
1 Comment
Walter Roberson
on 30 Nov 2024 at 21:45
Edited: Walter Roberson
on 30 Nov 2024 at 21:46
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))
sol1 = dsolve(eqn1); disp(char(sol1))
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.
Answers (1)
Torsten
on 30 Nov 2024 at 21:46
Moved: Torsten
on 30 Nov 2024 at 21:50
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))
0 Comments
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!