function [pos, maxval]=peak(data)
%
% peak
% function [pos maxval]=peak(data)
%
data = abs(data);
%main = find(data==max(data));
[p m]=peak2(.35,data');

if(length(p) == 0)
   pos = [];
   maxval = [];
else

	main = find(data==max(data(p(1):p(2)+20)));
	pos(1) = main;
	maxval(1) = data(main);

	I = 2;
	x = 0;

	while x < length(data),
		x = main*I;

		if x < (length(data)-25)

		maxval(I) = max(data(x-25:x+25));
		pos(I) = find(data(x-25:x+25)==maxval(I))+x-25;

		end;

		I = I + 1;
	end

end
