function y=expdata(A,B,N,M)
% expdata - exponential data sequence
%
% expdata :: 
%    real  ~'initial value',
%    real  ~'final value',
%    natural ~'number of steps (sequence length is steps+1),
%    M:natural ~'buffer size'
% -> seq [[1,M]].

	if nargin<4, M=1; end

	lA=log(A);
	k=(log(B)-lA)/N;
	y=unfoldseq(@ls1,0:M-1);

	function [X,I]=ls1(I), 
		surp=I(end)-N;
		if surp>=0,
			X=exp(lA+k*I(1:end-surp)); 
			if surp<M, X(end)=B; end
		else
			X=exp(lA+k*I); 
		end
		I=I+M; 
	end
end
	
