[ empty sym ] & "unable to find explicit solution" error when using dsolve for second order differential equation
2 次查看(过去 30 天)
显示 更早的评论
I'm trying to solve a second order differential equation with 4 variations of one of the initital conditions, but no matter if I try to do all of them at once (the commented d = line) or just one at a time (the d=1) matlab says "Warning: unable to find an explicit solution" and spits out "ySol1 = [ empty sym ]". I don't think there's no solution, as there are a couple follow up questions in the homework problem this is from. What am I doing wrong? Does this equation need ode45 over dsolve, and if so how would I format it?
syms y(t) d;
Dy = diff(y);
% d = [1 1.5 2 2.5];
d = 1;
cond1 = y(0) == d;
cond2 = Dy(0) == 0;
conds = [cond1 cond2];
ySol1 = dsolve(diff(y,t,2)+0.15*Dy-y+y^3 == 0, conds)
0 个评论
回答(1 个)
Jyotsna Talluri
2020-4-24
syms y(t)
[v] = odeToVectorField(diff(y,t,2)+0.15*diff(y,t)+y-y^3 == 0);
M = matlabFunction(v,'vars', {'t','Y'});
t= [0 20];
cond = [1 0];
sol = ode45(M, t, cond);
Refer to the documentation link below for more information
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!