close all

figure(1)
subplot(2,1,1)

plot(one.t, one.P1);
axis([0 2000 69.5 72])
xlabel('time(s)');
ylabel('Pressure(Bar)')
title('Bottom pressure(P1), single controller ')

subplot(2,1,2)
plot(cas.t, cas.P1);
axis([0 2000 69.5 72])
xlabel('time(s)');
ylabel('Pressure(Bar)')
title('Bottom pressure(P1), cascade controllers')




figure(2)
subplot(2,1,1)
plot(one.t, one.P2);

xlabel('time(s)');
ylabel('Pressure(Bar)')
axis([0 2000 50 56])
title('Top pressure(P2), single controller')

subplot(2,1,2)
plot(cas.t, cas.P2);
xlabel('time(s)');
ylabel('Pressure(Bar)')
axis([0 2000 50 56])
title('Top pressure(P2), cascade controllers')

figure(3)
subplot(2,1,1)
plot(one.t, one.w);
axis([0 2000 0 35])
xlabel('time(s)');
ylabel('Mass flow rate(kg/s)')
title('Mass flow through choke valve(w), single controller')

subplot(2,1,2)
plot(cas.t, cas.w);
axis([0 2000 0 35])
xlabel('time(s)');
ylabel('Mass flow rate(kg/s)')
title('Mass flow through choke valve(w), cascade controllers')

figure(4) 
hold all
plot(one.t, one.P1);
plot(cas.t, cas.P1,'--');
axis([0 100 70 71.5])
legend('Only P controller', 'Cascade control struture');
title('Bottom pressure(P1)')
figure(5)
hold all
plot(one.t, one.P2);
plot(cas.t, cas.P2,'--');
axis([0 100 50 52])
legend('Only P controller', 'Cascade control struture');
title('Top pressure(P2)')

figure(6)
hold all
plot(one.t, one.w);
plot(cas.t, cas.w,'--');
axis([0 100 0 20])
legend('Only P controller', 'Cascade control struture');
title('Mass flow through choke valve (w)')


%saving figures as eps format:
for fig = 1:6
    dir = 'c:\users\knutage\desktop\Prosjekt 2010\Min_rapport\latex_source\bilder\matlabfig\control_DeMeglio\';
    filename = ['figure', num2str(fig),'.eps'];
    saveas(figure(fig), [dir filename],'psc2');
    filename = ['figure', num2str(fig),'.jpg'];
    saveas(figure(fig), [dir filename]);
end