global  s b c3 c4 C c0 k1 k2 k1t k3t b1 b2 b3 b4 b9 b5 b6 b7 b8 b10 l c2;

observer=1;
figure(1);clf;
disp  'Generating Figure 1'
rho=1/10; runsurge_stall;
subplot(221)
plot(t,x(:,1),'r')
hold on
xlabel('t')
plot(t,x(:,6),'--')
title('R and its estimate')
grid;
subplot(222)
plot(t,x(:,2),'r')
hold on
xlabel('t')
axis([0 10 -.35 .1])
plot(t,x(:,7),'--')
title('\phi and its estimate')
grid;
subplot(212)
plot(t,x(:,3),'r')
hold on
xlabel('t')
plot(t,x(:,8),'--')
title('\psi and its estimate')
grid;


disp  'Generating Figure 2'
rho=1/50; runsurge_stall;
figure(2);clf;
subplot(221)
plot(t,x(:,1),'r')
hold on
xlabel('t')
plot(t,x(:,6),'--')
title('R and its estimate')
grid;
subplot(222)
plot(t,x(:,2),'r')
hold on
xlabel('t')
axis([0 10 -.35 .1])
plot(t,x(:,7),'--')
title('\phi and its estimate')
grid;
subplot(212)
plot(t,x(:,3),'r')
hold on
xlabel('t')
plot(t,x(:,8),'--')
title('\psi and its estimate')
grid;

disp  'Generating Figure 3'
observer=0;
runsurge_stall;
figure(3); clf;
plot3(x(:,1),x(:,2),x(:,3));
hold on;;;
observer=1;
rho=1/5;
runsurge_stall;
plot3(x(:,1),x(:,2),x(:,3),'o');
rho=1/7;
runsurge_stall;
plot3(x(:,1),x(:,2),x(:,3),'d');
rho=1/100;
runsurge_stall;
plot3(x(:,1),x(:,2),x(:,3),'.');
xlabel('R');
ylabel('\phi');
zlabel('\psi');
legend('state feedback','\rho=1/5','\rho=1/7','\rho=1/100',1);
view(154,48);
grid;
