# [ empty sym ] & "unable to find explicit solution" error when using dsolve for second order differential equation

2 views (last 30 days)
James Stirling on 21 Apr 2020
Answered: Jyotsna Talluri on 24 Apr 2020
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)

Jyotsna Talluri on 24 Apr 2020
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);

### Categories

Find more on Equation Solving in Help Center and File Exchange

R2019b

### Community Treasure Hunt

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

Start Hunting!