clear
clc
s = .2:.2:2.;
figure(1)
title('NA Machine problem 5 part B')
hold on
set(gca,'FontName','Symbol')
set(gca,'XTick',0:pi/16:pi/4)
set(gca,'XTickLabel',{'0','pi/16','pi/8','3pi/16','pi/4'})
for i = 1:length(s)
[tv, f1] = ode45('fun1',[0,pi/4],[0 s(i)]);
plot(tv,f1(:,1))
end

[n,x] = bisec(.5,1.5,0.5e-12);
fprintf('\t\t Bisection method \n')
fprintf('\tIterations \t Value\n')
fprintf('\t%3.0f \t\t %1.16f\n',n,x)
plot([0:.01:pi/4],x,'*');

figure(2)
title('NA Machine problem 5 part C')
[tv, f1] = ode45('fun1',[0,pi/4],[0 x]);
plot(tv,f1(:,1))