%% nsectiontest
%
fun=@sin;
 n=11;
 n=21;
 n=50;
initint=[-10 10];
tol=0.01;
[br,mid]=nsection(fun,initint,n,tol);
%% Visualization
clf
x=linspace(-10.1,10.1);y=sin(x);
plot(x,y);grid on;shg
hold on
lefts=br(:,1);rights=br(:,2);
plot(lefts,-0.1,'rx')
plot(rights,0.1,'bo')
plot(mid,0*mid,'k*')
title(['n= ' num2str(n) ', tol = ' num2str(tol)])

