%% Solve Second-Order Differential Equation
%% 1

syms y(t)
V = odeToVectorField(diff(y, 2) == (1 - y^2)*diff(y) - y)
M = matlabFunction(V,'vars', {'t','Y'})
interval = [0 20];
y0 = [2 0];
ySol = ode45(M,interval,y0);

%
%% 2

tValues = linspace(0,20,100);
yValues = deval(ySol,tValues,1);
plot(tValues,yValues)

% Copyright 2015 The MathWorks, Inc.