
[T,Y]=threeplot('lorenzmio',8,3,33,0,200);

figure(1);
clf
DY = diff(Y(:,3));
ave=sum(Y(2:end-1,3))/length(Y(2:end-1,3));
maxs = DY(1:end-1).*(DY(2:end))<0&Y(2:end-1,3)>ave;
maxT = T(find(maxs)+1);
maxZ = Y(find(maxs)+1,3);

%plot(T,Y(:,3),'or-',T(2:end-1),40*maxZ,'o-')

mm = min(maxZ(1:end-1));
MM = max(maxZ(1:end-1));

ms=5;
plot(maxZ(1:end-1),maxZ(2:end),'.','MarkerSize',ms)
hold on
plot([mm MM],[mm MM],'r-')
%plot(2*38.55-maxZ(1:end-1),maxZ(2:end),'g.','MarkerSize',ms)
hold off 