clear; close all;
%
x = 0:0.01:20; y = bessel(1,x); n = length(x);
%subplot(1,2,1); plot(x,y);
dy = zeros(1,n-2);
for i=2:n-1
   dy(i-1) = (y(i+1)-y(i-1))/(x(i+1)-x(i-1));
end
%subplot(1,2,2);
h = plot(x(2:n-1),dy);
legend(h,'\it f''(x)');
ady = abs(dy);
tol = min(ady);
eps = 4*tol;
ix = find(ady<eps);
hold on
plot(x(ix+1),dy(ix),'ro','MarkerEdgeColor','k','MarkerFaceColor','r',... 
     'MarkerSize',8);
%print -deps minmaxd.eps
