I am getting the error message "unable to find symbolic solution" using dsolve.
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2024-11-30
编辑:Walter Roberson
2024-11-30
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.
回答(1 个)
Torsten
2024-11-30
移动:Torsten
2024-11-30
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!