function rp=rosslerx(t,r)
% ROSSLERX(T)  Rossler attractor function
% X=ROSSLERX(T) returns the x-component of the Rossler attractor
% at times T.  T must be an all non-negative, increasing vector.
% The initial condition of the attractor is x=0; y=-10; z=0;
% (at time zero).  The attractor is quasi-periodic, with average
% period 2*pi and average amplitude of the x-component about 12.

% Rossler, O.E. "An Equation for Continuous Chaos," Physics Letters,
% Volume 57 A, no. 5, July 1976, p. 397.

% Fraser, Andrew M., and Swinney, Harry L.  "Independent Coordinates
% for Strange Attractors from Mutual Information."  Physical 
% Review A, Volume 33, no. 2, Feb. 1986, p. 1134.

if (nargin == 2)	% ODEFile functionality
	rp=[0;0;0];
	rp(1)=-r(2)-r(3);			% Rossler x'
	rp(2)=r(1)+0.15*r(2);		% Rossler y'
	rp(3)=0.2+r(3)*(r(1)-10);	% Rossler z'

else
	t=t(:);
	addflag=0;
	if t(1)
		t=[0;t];	
		addflag=1;
	end
	[td,r]=ode45('rosslerx',t,[0;-10;0]);
	rp=r(:,1);
	if addflag
		rp=rp(2:end);
	end
end
