function tmax = optimize_raptorchase(theta)


anglegrid = 0:0.01:2*pi;
nangles = length(anglegrid);
survival = zeros(nangles,1);

for i=1:nangles
    subplot(1,2,1);
    survival(i) = show_raptorchase(anglegrid(i));
    subplot(1,2,2);
    plot(anglegrid(1:i), survival(1:i));
    ylabel('Survival time (sec)');
    xlabel('Angle (radians)');
    xlim([0,2*pi]);
    ylim([0,2]);
    drawnow;
end

