% duffing oscillator. Compu Expt 7.3

F = @(t, x) [ x(2); -0.1*x(2)+x(1)-x(1).^3+2*sin(t)];
xo = [1;1];                              % IC for p-6pi
xo = [-1;-1];                              % IC for p-2pi
xo = [-5;0];                              % IC for other p-6pi
[ts, xs]  = ode45(F, [0 200], xo);
j = find(ts>100);
figure; plot(xs(j,1), xs(j,2), '-');
axis equal; axis([-5 5 -5 5]);
figure; plot(ts(j), xs(j,:), '-');
