%
%   Cubic Spline with State Constraint
%   Example due to John v: Breakwell
%   
load bryson1.dat
t1=bryson1(:,1);
x1=bryson1(:,2);
v1=bryson1(:,3);
u1=bryson1(:,7);
%
load bryson2.dat
t2=bryson2(:,1);
x2=bryson2(:,2);
v2=bryson2(:,3);
u2=bryson2(:,7);
%
load bryson3.dat
t3=bryson3(:,1);
x3=bryson3(:,2);
v3=bryson3(:,3);
u3=bryson3(:,7);
%
subplot(221)
plot(t1,x1,'b:')
axis([0 1 0 0.3])
xlabel('State variable x(t)','FontSize',12)
hold
plot(t2,x2,'b--')
plot(t3,x3,'b')
plot([0 0.3 0.5 0.7 1],[0 0.1 0.2 0.1 0],'ko','MarkerSize',7)
%
subplot(222)
plot(t1,v1,'b:')
axis([0 1 -1.1 1.1])
xlabel('State variable v(t)','FontSize',12)
hold
plot(t2,v2,'b--')
plot(t3,v3,'b')
plot([0 1],[1 -1],'ko','MarkerSize',7)
%
subplot(223)
plot(t1,u1,'b:')
axis([0 1 -7 1])
xlabel('Control variable u(t)','FontSize',12)
hold
plot(t2,u2,'b--')
plot(t3,u3,'b')
%
print -depsc bryson
%
%




















