[ 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)

回答(1 个)

Jyotsna Talluri
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

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by