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

2 views (last 30 days)
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)

Answers (1)

Jyotsna Talluri
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);
Refer to the documentation link below for more information

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!