function [T,Y]=driver_chua(xo,yo,zo,tf,trans,c3)
%Integrates the Chua circuit
%
%  Examples:
%             
%[T,Y]=driver_chua(0.1,0,1,20,100,50);		%period 1
%[T,Y]=driver_chua(0.1,0,1,20,100,35);		%period 2
%[T,Y]=driver_chua(0.1,0,1,20,100,33.8);	%period 4
%[T,Y]=driver_chua(0.1,0,1,100,100,33);		%chaos 2 lobes
%[T,Y]=driver_chua(0.1,0,1,100,100,25.58);	%chaos

format compact

options= odeset('Reltol',1.e-5);
options= odeset('Reltol',1.e-22,'OutputFcn','odephas3','Refine',22);
%options= odeset('Reltol',1.e-3,'OutputFcn','odephas3','Refine',2);
%options= odeset('Reltol',1.e-3);

 init=[xo yo zo]';
 tspan=[0 tf];
 c3
 
 [T,Y]=ode45('chua',trans,init,options,c3);
 [T,Y]=ode45('chua',tspan,Y(end,:),options,c3);
 
 figure(2)
 clf
 plot3(Y(:,1),Y(:,2),Y(:,3))
 hold on
 xlabel('x')
 ylabel('y')
 zlabel('z')
 title('chua')
 rotate3d
 view([60 45]);
 axis tight
 grid
 hold off

 figure(3)
 clf
 hold on
 xlabel('t')
 ylabel('x!y!z')
 plot(T,Y(:,1),'r-',T,Y(:,2),'b-',T,Y(:,3),'g-')
 hold off
 axis tight

