Forced Damped Double-Well Oscillator

Strogatz section 12.5

in 1979, Moon & Holmes studied the forced damped double-well oscillator
In this demonstration we fix and
First we show that for sm
clf;hold off
delta=1/4;
omega=1;
F=0.18;
myODE=@(t,y)(doublewellODE(t,y,delta,F,omega));
tFinal=100;
[tPlus,yPlus]=ode45(myODE,[0 tFinal],[.4;0]);
[tMinus,yMinus]=ode45(myODE,[0 tFinal],[-.4;0]);
plot(tPlus,yPlus(:,1),tMinus,yMinus(:,1));xlabel('$t$');ylabel('$x$')
F=0.4;
myODE=@(t,y)(doublewellODE(t,y,delta,F,omega));
myEvent=@(t,y)doublewellEvent(t,y,omega);
options=odeset('Events',myEvent);
[t,y,te,ye]=ode45(myODE,[0 tFinal],[.4;0],options);
plot(t,y(:,1),te,ye(:,1),'o');xlabel('$t$');ylabel('$x$')
plot(y(:,1),y(:,2),ye(:,1),ye(:,2),'o')
xlabel('$x$');ylabel('$\frac{dx}{dt}$')
tFinal=5000*2*pi;
tTransient=10*2*pi;
myEvent=@(t,y)doublewellEvent(t,y,omega);
options=odeset('Events',myEvent);
[~,~,te,ye]=ode45(myODE,[0 tTransient+tFinal],[.4,0],options);
p=find(te>tTransient,1,'first');
ye=ye(p:end,:);
x=ye(:,1);y=ye(:,2);
plot(x,y,'.')

Box-counting step

N=7;
epsilon=zeros(1,N);
Nboxes=zeros(1,N);
for k=1:N
K=2^(k+1);
[epsilon(k),Nboxes(k)]=countAndPlotBoxes(x,y,K);
end