figure('Position',[500 500 1000 300]);
%%
a = 0;
b = 1;
alpha = 0;
beta = 0;
f = @(t,x) [x(2); 2*x(1)^2];
s = -45:1:5;
r = zeros(1,length(s));
for ii = 1:length(s)
    r(ii) = residual(s(ii),f,a,b,alpha,beta);
end
subplot(1,2,1); plot(s,r,'LineWidth',3); hold on; plot(s,zeros(1,length(s)),'k--','LineWidth',3);

% format
axis([-45 5 -5 15]);
ax = gca;
set(ax,'TickLabelInterpreter','latex');
ax.TickLength = [0.02 0.02];
set(gca,'fontsize',20)
str='$s$';
xlabel(str,'interpreter','latex','FontSize',24);
str='$\Phi(s)$';
ylabel(str,'interpreter','latex','FontSize',24);
str='(a)';
title(str,'interpreter','latex','FontSize',24);
%%
a = 0;
b = 1;
alpha = 0;
beta = 0;
f = @(t,x) [x(2); x(1)^2];

%
s0 = 0;
[t,y,~] = nonlinearShooting(f,a,b,alpha,beta,s0);

subplot(1,2,2); plot(t,y(:,1),'LineWidth',3); hold on;

%
s0 = -30;
[t,y,~] = nonlinearShooting(f,a,b,alpha,beta,s0);

subplot(1,2,2); plot(t,y(:,1),'LineWidth',3);

% format
axis([0 1 -12 2]);
ax = gca;
set(ax,'TickLabelInterpreter','latex');
ax.TickLength = [0.02 0.02];
set(gca,'fontsize',20)
str='$t$';
xlabel(str,'interpreter','latex','FontSize',24);
str='$x$';
ylabel(str,'interpreter','latex','FontSize',24);
str='(b)';
title(str,'interpreter','latex','FontSize',24);

tightfig;