%The script TRANS_C plots extremals of Examples 5.8 and 5.9.
% Figure 1 is a plot of the extremal of Example 5.8.
% Plots of Figures 2 and 3 are lumped into Figure 4---this is Example 5.9.

%         modified by S. H. Zak on Dec. 8, 2003

clear
t11=(1+sqrt(3/4))^(1/3)
t12=(1-sqrt(3/4))^(1/3)
C11=(1-t11^3)/t11;
C12=(1-t12^3)/t12;
x11='C11*t+t.^3';
x12='C12*t+t.^3';
x5_9='-3*t+t.^3';
t=0:0.0001:1;
axis([0 1 -2.4 0.2])
hold
plot(t,eval(x5_9))
set(gca,'Fontsize',12)
xlabel('\it t','Fontsize',12)
ylabel('\it x','Fontsize',12)
title('A plot of the extremal, x(t)=-3t+t^3, of Example 5.8.','Fontsize',12)
text(0.22,-0.4,'the right end-point is on \it t=t_{\rm 1}=\rm 1','Fontsize',12)
grid
box
hold off
figure
t=0:0.0001:t11;
axis([0 t11 -0.4 1])
hold
plot(t,eval(x11))
set(gca,'Fontsize',12)
xlabel('\it t','Fontsize',12)
ylabel('\it x','Fontsize',12)
title('Plot of one of the extremals of Example 5.9.','Fontsize',12)
fsstr='at the end-point {\it t}_1= ';
text(0.2,0.2,[fsstr num2str(t11)],'Fontsize',12)
grid
box
hold off
figure
axis([0 t12 0 1])
hold
t=0:0.0001:t12;
plot(t,eval(x12))
set(gca,'Fontsize',12)
xlabel('\it t','Fontsize',12)
ylabel('\it x','Fontsize',12)
title('Plot of the second extremal of Example 5.9.','Fontsize',12)
fsstr='at the end-point {\it t}_1= ';
text(0.1,0.85,[fsstr num2str(t12)],'Fontsize',12)
grid
box
hold off
figure
axis([0 t11 -0.4 1])
hold
t=0:0.0001:t12;
plot(t,eval(x12))
t=0:0.0001:t11;
plot(t,eval(x11))
set(gca,'Fontsize',12)
xlabel('\it t','Fontsize',12)
ylabel('\it x','Fontsize',12)
title('Plots of two extremals of Example 5.9.','Fontsize',12)
fsstr='{\it t}_1= ';
text(0.12,0.9,[fsstr num2str(t12)],'Fontsize',12)
fsstr='{\it t}_1= ';
text(0.92,0.9,[fsstr num2str(t11)],'Fontsize',12)
grid
box
hold off
