% air_fuel_sim.M - Simulation of air-fuel control
% KJA, 2012

aminit; 					% initialize FBS macros

kpo = 2; kio = 4;
kpa = 1; kia = 1;
tmax = 30;
tsim = [0:0.01:tmax];

subplot(421)
[t, x, y] = sim('air_fuel', tsim);
pl = plot(t, y(:, 1), 'b--', t, y(:, 2), 'b-', t, y(:, 5), 'r-');
set(gca, 'Ytick', [0 0.5 1]);
set(pl, 'Linewidth', AM_data_linewidth);
amaxis([0 tmax 0 1.2]);
ylabel('y');

subplot(423)
pl = plot(t, y(:, 3), 'b--', t, y(:, 4), 'b-');
set(gca, 'Ytick', [0 0.5 1]);
set(pl, 'Linewidth', AM_data_linewidth);
amaxis([0 tmax 0 1.2]);
xlabel('t'); ylabel('u');

amprint('air-fuel.eps')
