function [Time,X,V,Te,Xe,Ve]=Poin(Nper,X0,V0) global Lambda Omega0 Omega F Tdrive Nskip options = odeset('RelTol',1e-9,'AbsTol',1e-9,'Events','on'); Tinit = 0; Tfin = Nper*Tdrive; Tskip = Nskip*Tdrive; Np = 50*fix((Tfin-Tinit)/Tdrive); Ts = linspace(Tskip, Tfin, Np); Ts(1)=[]; Tspan =[Tinit Tskip Ts]; XV0 = [X0; V0]; [Time,XV,Te,XVe,Ie] = ode45('PXVdot',Tspan, XV0, options); X = XV(:,1); V = XV(:,2); X(1) =[]; V(1)=[]; Time(1)=[]; IJ = find(Te >= Tskip); Xe = XVe(IJ(:,1),1); Ve = XVe(IJ(:,1),2); Xpi=2*pi*ones(size(Xe)); xe = mod(Xe,Xpi)/pi; subplot(3,1,1) plot(X/pi,V*Tdrive/pi,'b'),grid on, zoom on,hold on plot(Xe/pi,Ve*Tdrive/pi,'ro') hold off xlabel('\theta/\pi'),ylabel({'\theta /\pi and \omega T_{drive}/\pi '}) title({'Phase space portrait'}) subplot(3,1,2) plot(xe,Ve*Tdrive/pi,'b.'),grid on, zoom on xlabel('\theta/\pi'),ylabel('\omegaT_{drive}/\pi') title({'Poincare surface of section'}) subplot(3,1,3) plot(Time/Tdrive,X,'b-',Time/Tdrive,V*Tdrive/pi,'r--') grid on, zoom on xlabel('time/T_{drive}'), ylabel({'\theta /\pi and \omega T_{drive}/\pi '}) title({'\theta (t)/\pi and \omega (t)T_{drive}/\pi versus t/T_{drive}'})